views:

367

answers:

2

Working on a page with multiple sections.

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

beneath that is a section for adding new data... beneath that is a section for updating data... beneath that is a section for deleting data... and... beneath that is a section for viewing data... (repeater)

not even really concerned about the updating and deleting sections at this point... just stating that they are there so show the general layout of the page.

Now.. when I go to add new data, the submit button is set up as a trigger for an update panel that surrounds the repeater at the bottom of the page... that works perfectly... BUT its not removing the text from the text boxes or updating the status label because the page is only partialy posting back... (obviously)

when you click the button i also want the label to display ("You added data") and the text boxes to be emptied out... SOOO... i thought i'd be tricky and put an update panel around the status and the adding and setting their triggers to the same button... doesnt seem to work :-\ i usually dont bother with update panels... but this page has the potential to have A LOT of text data and formatting...

any ideas?

A: 

Are you saying you want multiple updatepanels on the same page?

If so see this

Rippo
Yes i want multiple update panels on the same page that are updated with a single button click
Patrick
A: 

Figgured 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>

Above is the basic layout of the page.... keep in mind that there is other content between each of the update panels... (i still need to add functionality to edit and delete as well) With the btnaddkey click the following code occurs:

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 = "";
    }

Problem was that i need the labels and the text boxes (each in their own update panels) to all update on that one click....

using the above code it is working now

Patrick