Sys.WebForms.PageRequestManager initializeRequest Event
Raised during the initialization of the asynchronous postback.
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initializeRequestHandler) Sys.WebForms.PageRequestManager.getInstance().remove_initializeRequest(initializeRequestHandler)
The initializeRequest method is raised before processing of the asynchronous request starts. You can use this event to cancel a postback.
For more information about the PageRequestManager event model, see Working with Partial-Page Rendering Events.
The following example shows how to use the initializeRequest event to cancel an asynchronous postback. Script in the initializeRequest event handler determines whether an asynchronous postback is currently in progress by using the isInAsyncPostBack property of the PageRequestManager class. If a postback is in progress, the postBackElement property of the Sys.WebForms.InitializeRequestEventArgs class is used to determine the ID of the element that caused the postback. If the ID matches the ID of a button that cancels the postback, the abortPostBack method is called. Otherwise, the current request is canceled by using the cancel property of the Sys.CancelEventArgs class.