UpdatePanel in ASP.NET Ajax

This entry is part 10 of 13 in the series ASP.NET Ajax

Update Panel is used to update the partial portion of the web page. It has two sub elements
1. ContentTemplate – used to specify the content need to update partially
(Look at UpdatePanelSimple.aspx page)
2. Triggers
a. AsyncPostBackTrigger – used to associate a control outside update panel that will trigger the asynchronous postback.
Whatever content we keep under the ContentTemplate, all are sent to the server when a partial post back happens. So if we have kept the button that is causing the partial postback also in the ContentTemplate that button code also goes to the server, however that is not required. In order to avoid this kind of scenario, we can keep the button outside the update panel and keep only those elements inside update panel that is really required to send the request the get the response. However the outside button can be associated with the UpdatePanel using AsyncPostBackTrigger.
AsyncPostBackTrigger accepts two parameters
a. ControlID – the id of the element (button) that is associated with the UpdatePanel
b. EventName – the name of event which is used to trigger the postback
b. PostBackTrigger – used to associate a control inside UpdatePanel that will trigger the postback instead of asynchronous postback.

Series Navigation«ScriptManager in ASP.NET AjaxHow to conditional update UpdatePanel in ASP.NET Ajax?»

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.