Σχόλια 0

Το κείμενο της παρουσίασης

The two main Microsoft AJAX Library classes that raise events during the client lifecycle of a page are theApplicationandPageRequestManagerclasses.The key event for initial requests (GET requests) and synchronous postbacks is theloadevent of theApplicationinstance. When script in aloadevent handler runs, allscripts and components have been loaded and are available.When partial-page rendering withUpdatePanelcontrols is enabled, the key clientevents are the events of thePageRequestManagerclass. These events enable you tohandle many common scenarios. These include the ability to cancel postbacks, to giveprecedence to one postback over another, and to animateUpdatePanelcontrols whentheir content is refreshed.To add or remove handlers for events raised by theApplicationandPageRequestManagerclasses, use theadd_eventname andremove_eventname methodsof those classes.Note: To handle theloadandunloadevents of theApplicationobject, you can createfunctions that use the reserved namespageLoadandpageUnload.function pageLoad() {var prm = Sys.WebForms.PageRequestManager.getInstance();

if (!prm.get_isInAsyncPostBack())prm.add_beginRequest (onBeginRequest);}Sys.WebForms.PageRequestManager EventsinitializeRequestRaised during initialization of an asynchronous postback.beginRequestRaised before processing of an asynchronous postback starts, and the postbackrequest is sent to the server. If there is a postback already processing, it isstopped using theabortPostBackmethod.pageLoadingRaised after a response to an asynchronous postback is received from the server,but before any content on the page is updated.pageLoadedRaised after all content on the page is refreshed as the result of either asynchronous or an asynchronous postback.endRequestRaised after an asynchronous postback is finished and control has been returnedto the browser. If an error occurs, the page is not updated. Use this event toprovide customized error notification to users or to log errors.

Sys.Application EventsinitRaised only once when the page is first rendered after all scripts have beenloaded, but before objects are created.loadRaised after all scripts have been loaded and objects in the application havebeen created and initialized. Raised also for all postbacks to the server, whichincludes asynchronous postbacks.unloadRaised before all objects in the client application are disposed. During this eventyou should free any resources that your code is holding.MicrosoftASP.NET AJAX Client Life-Cycle Events