Search code examples
c#asp.netupdatepanel

Can the asyncpostbacktrigger of an update panel have two control IDs?


I have a button outside an update panel which controls an update panel very well. I also want another button to update this same update panel when the click event is triggered. How can I achieve this?


Solution

  • You can have multiple triggers registered to a single update panel. Something like the following should work:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
      <ContentTemplate>
      </ContentTemplate>
      <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
      </Triggers>
    </asp:UpdatePanel>