Friday, October 26, 2007

Ajax UpdatePanel (5) PostBackTrigger

Triggers(3) ==> PostBackTrigger:


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

<ContentTemplate>

<%= DateTime.Now %>

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

</ContentTemplate>

<Triggers>

<asp:PostBackTrigger ControlID="Button2" />

</Triggers>

</asp:UpdatePanel>

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

<ContentTemplate>

<%= DateTime.Now %>

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

</ContentTemplate>

</asp:UpdatePanel>

In this code, Button1 will update both UpdatePanels, Button2 will update both UpdatePanels, but Button2 will trigger a synchronous postback (whole page refresh).

blog comments powered by Disqus