Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Sys.WebForms.PageRequestManager beginRequest Event

Raised before the processing of an asynchronous postback starts and the postback request is sent to the server.

Syntax

Sys.WebForms.PageRequestManager.instance.add_beginRequest(beginRequestHandler)
Sys.WebForms.PageRequestManager.instance.remove_beginRequest(beginRequestHandler)

Term

Definition

beginRequestHandler

The name of the handler method that will be called.

Remarks

The beginRequest event is raised before the processing of an asynchronous postback starts and the postback is sent to the server. You can use this event to call custom script to set a request header or to start an animation that notifies the user that the postback is being processed.

For more information about the PageRequestManager event model, see Working with PageRequestManager Events.

Example

The following example shows how to use the beginRequest function to display a simple progress notification during asynchronous postbacks. The Button1 control invokes the Sleep(Int32) method to simulate a long-running process on the server. The Button2 control invokes a server handler that is faster. If you click Button2 while the asynchronous postback from Button1 is still processing, the Button1 postback is canceled.