updatepanel usage example of triggers usage

  • 2020-12-13 18:57:10
  • OfStack

asyncpostbacktrigger (asynchronous callback trigger) : local refresh, only the contents inside updatepanel are refreshed
postbacktrigger (normal callback trigger) : Refresh all


<asp:ScriptManager ID="ScriptManager1" runat="server"> 
</asp:ScriptManager> // There must be, 1 Set in the updatepanel In front of the 
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
  <% =DateTime.Now.ToString()%>
</ContentTemplate>
<Triggers>
  <asp:PostBackTrigger ControlID="btn" />
  <asp:AsyncPostBackTrigger ControlID="btn2" EventName="click" />
</Triggers>
</asp:UpdatePanel>
<asp:Button runat="server" Text=" The refresh 1" id="btn"/>
<asp:Button runat="server" Text=" The refresh 2" id="btn2" />
<% =DateTime.Now.ToString()%>


Related articles: