UpdatePanel to execute an update - ASP.NET AJAX

Q.  AnUpdatePanel control defined on a page. Button control is placed outside of the UpdatePanel. How to cause the UpdatePanel to execute an update.
- Published on 31 Aug 15

a. Set the Trigger attribute of the UpdatePanel to the ID of the Button control.
b. Set the AsyncPostBackTrigger attribute of the Button control to the ID of theUpdatePanel.
c. Place the button control on the update panel without script manager.
d. Add an AsyncPostBackTrigger control to the Triggers section of the UpdatePanel. Set the ControlID attribute of the AsyncPostBackTrigger control to the ID of the Button control.

ANSWER: Add an AsyncPostBackTrigger control to the Triggers section of the UpdatePanel. Set the ControlID attribute of the AsyncPostBackTrigger control to the ID of the Button control.
 
To connect a control that is outside an UpdatePanel and you want that this outside control should trigger the update then you should register it as an asyncPostBackTrigger in the Triggers section of the UpdatePanel markup.

<asp:UpdatePanel ID="UpdatePanelVendors" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)