Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between AsyncPostBackTrigger & PostBackTrigger?

What is the difference between AsyncPostBackTrigger & PostBackTrigger?

like image 272
vmahdavi Avatar asked Feb 06 '11 09:02

vmahdavi


People also ask

What is the use of AsyncPostBackTrigger?

Use the AsyncPostBackTrigger control to enable controls to be triggers for an UpdatePanel control. Controls that are triggers for an update panel cause a refresh of the panel's content after an asynchronous postback.

What is ASP AsyncPostBackTrigger?

Description. <asp:AsyncPostBackTrigger> Specifies a control and event that will cause a partial page update for the UpdatePanel that contains this trigger reference. <asp:PostBackTrigger> Specifies a control and event that will cause a full page update (a full page refresh).

What is the difference between synchronous postback and asynchronous postback?

The difference between synchronous and asynchronous postback is thatAsynchronous postback renders only the required part of the page and whereas, synchronous postback renders the entire page for any postback.

What is UpdatePanel?

UpdatePanel controls are a central part of AJAX functionality in ASP.NET. They are used with the ScriptManager control to enable partial-page rendering. Partial-page rendering reduces the need for synchronous postbacks and complete page updates when only part of the page has to be updated.


2 Answers

Controls inside an UpdatePanel by default cause a partial page update, controls outside cause a postback, using these triggers it is possible to change this behaviour as required.

From http://seminaarit.codezone.fi/video/devdays-2007/track1/2/2-ASP-dotNET_AJAX_Extensions.ppt: (dead link)

AsyncPostBackTrigger

  • Converts postbacks into async callbacks * Typically used to trigger updates when controls outside an UpdatePanel post back * If ChildrenAsTriggers="false", can be used to specify which controls inside UpdatePanel should call back rather than post back

PostBackTrigger

  • Lets controls inside UpdatePanel post back. * Typically used to allow certain controls to post back when ChildrenAsTriggers="true"
like image 134
PMC Avatar answered Oct 04 '22 10:10

PMC


Here's a blog post which explains the difference:

In the template in an update panel, there are the options of an AsyncPostBackTrigger or a PostBackTrigger.

By default, controls outside of an update panel will trigger a normal synchronous post back. The AsyncPostBackTrigger “wires” up these controls to trigger an asynchronous post back. Conversely, controls declared inside an update panel will trigger an asynchronous call by default. The PostBackTrigger short circuits this, and forces the control to do a synchronous post back.

like image 22
Darin Dimitrov Avatar answered Oct 04 '22 10:10

Darin Dimitrov