开发者

Asynchronous and synchronous postback in ASP.NET

开发者 https://www.devze.com 2022-12-20 04:46 出处:网络
开发者_JAVA百科What are the differences between asynchronous and synchronous postback? From Plz tell me difference synchronous postback and asynchronous Postback
开发者_JAVA百科

What are the differences between asynchronous and synchronous postback?


From Plz tell me difference synchronous postback and asynchronous Postback

Asynchronous postback behaves much as the synchronous postback, All the server page life-cycle events occur. But in rendering phase, in an asynchronous postback only the contents of the update panels are sent back to the browser where as in synchronous postback all the page content is refreshed/sent back to the browser.

See also Partial-Page Rendering Overview

An asynchronous postback behaves much like a synchronous postback. All the server page life-cycle events occur, and view state and form data are preserved. However, in the rendering phase, only the contents of the UpdatePanel control are sent to the browser. The rest of the page remains unchanged.


AsyncPostBackTrigger: Asynchronous Postback triggers update the page partially without refreshing the whole page (AJAX)
-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: Postback triggers update the complete page caused by complete post of the page to the server.
-Lets controls inside UpdatePanel post back
-Typically used to allow certain controls to post back when ChildrenAsTriggers="true"


Asynchronous postback are generally used to provide enhanced browser functionality with the help of javascript. for example , filling designations in an department based on a department selected in a dropdownlist without causing a full page refresh.

use can use ASP Update panels- http://www.asp.net/Ajax/Documentation/Live/overview/UpdatePanelOverview.aspx

XMLHTTP REQUEST to call asp.net pages http://www.w3schools.com/XML/xml_http.asp

ASP>NET AJAX and web services http://www.asp.net/Ajax/Documentation/Live/tutorials/ExposingWebServicesToAJAXTutorial.aspx


The synchronous postback uploads your html in the request back to the server so that the server can remember the data viewstate of the page so it allow you to get the information from the input fields entered by the user and it require that the page get refreshed.

The asynchronous postback, allow you to call a specific function on the server and the response of the server can be json, xml or html and then you parse this response and respond to it using javascript which allow you to enhance the user experience as the page doesn't refresh and it doesn't take to much time to call the method and get the response as it doesn't require uploading the html in the request.

0

精彩评论

暂无评论...
验证码 换一张
取 消