How can I update an UpdatePanel programmatically?

     You can use the Update method of the UpdatePanel on the server-side. Make sure to set
the UpdateMode of the UpdatePanel to Conditional to get it work.



<asp:UpdatePanel UpdateMode="Conditional" ID="UpdatePanel1"...>



UpdatePanel1.Update()



You can also use triggers that will make sure the UpdatePanel listen to a control’s event and will do an update if the event if fired and caused by a postback. Example:



<asp:UpdatePanel ID="UpdatePanel1" runat="server">

         <ContentTemplate>

               ...

         </ContentTemplate>

         <Triggers>

                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />

          </Triggers>

</asp:UpdatePanel>



<asp:Button ID="Button1" runat="server" Text="Button" />
Reactions

Post a Comment

0 Comments

Close Menu