Refresh panel triggers

Working with a page with multiple sections.

at the very top there is a "status" label.

below is the section for adding new data ... below it is the section for updating data ... below is the section for deleting data ... and also ... below it is the section for viewing data ... (repeater)

not even very concerned about updating and deleting sections at this point ... just stating that they are there so will show the overall page layout.

Now ... when I go to add new data, the submit button is configured as a trigger for the refresh panel that surrounds the relay at the bottom of the page ... which works great ... BUT its not removing text from text fields or updating the status label because the page only partially sends back ... (obviously)

when you click on the button i also want the label to be displayed ("you added data") and the text boxes to be emptied ... SOOO ... i thought it would be difficult for me to put an update bar around the status and add and setting their triggers to the same button ... doesn't seem to work: - \ i usually doesn't bother the refresh bar ... but this page has the potential to have a lot of text data and formatting ..

any ideas?

+2


source to share


2 answers


Found it out.

<asp:updatepanel id="updatepanel1" runat="server">
     <contenttemplate>
          <asp:label id="lblstatus" runat="server /> <br />
     </contenttemplate>
     <triggers>
          <asp:asyncpostbacktrigger controlid="btnaddkey" eventname="Click" />
     </triggers>
</asp:updatepanel>

<asp:updatepanel id="updatepanel2" runat="server">
     <contenttemplate>
          <asp:textbox id="tbxkeyname" runat="server />      
          <asp:textbox id="tbxkeytitle" runat="server />      
          <asp:textbox id="tbxkeyvalue" runat="server />      

     </contenttemplate>
     <triggers>
          <asp:asyncpostbacktrigger controlid="btnaddkey" eventname="Click" />
     </triggers>
</asp:updatepanel>

<asp:button id="btnaddkey" runat="server" text="submit" OnClick="btnAddKey_Click" />

<asp:updatepanel id="updatepanel3" runat="server">
     <contenttemplate>
          <asp:repeater id="rptkeyview" runat="server">
               ...
          </asp:repeater>         
     </contenttemplate>
     <triggers>
          <asp:asyncpostbacktrigger controlid="btnaddkey" eventname="Click" />
     </triggers>
</asp:updatepanel>

      

Below is the basic layout of the page. Keep in mind that there is different content between each of the update panels ... (I still need to add functionality to edit and delete) Press the following code with btnaddkey:



protected void btnAddKey_Click(object sender, EventArgs e)
    {
        Configuration toConfiguration = new Configuration();
        toConfiguration.Title = tbxKeyTitle.Text;
        toConfiguration.Name = tbxKeyName.Text;
        toConfiguration.Value = tbxKeyValue.Text;
        toConfiguration.AddKey();
        lblStatus.Text = "New Key Added.";
        BindKeys();
        tbxKeyName.Text = "";
        tbxKeyTitle.Text = "";
        tbxKeyValue.Text = "";
    }

      

The problem was that I needed shortcuts and textboxes (each of their own update panels) for all updates in one click ....

using the above code it works now

+3


source


Are you saying that there are several update servers on the same page?



If yes, see this

0


source







All Articles