The following are the life-cycle events raised on the client side for the PageRequestManager object:
|
PageRequestManager event |
Description |
|
initializeRequest |
Raised before processing of the asynchronous request starts. You can use this event to cancel a postback. |
|
beginRequest |
Raised before processing of an asynchronous postback starts and the postback is sent to the server. You can use this event to set request headers or to begin an animation that indicates that the page is processing. |
|
pageLoading |
Raised after the response from the server to an asynchronous postback is received but before any content on the page is updated. You can use this event to provide a custom transition effect for updated content. |
|
pageLoaded |
Raised after all content on the page is refreshed, as a result of either a synchronous or an asynchronous postback. You can use this event to provide a custom transition effect for updated content. |
|
endRequest |
Raised after an asynchronous postback is finished and control has been returned to the browser. You can use this event to provide a notification to users or to log errors. |
To capture them on the client side put the following in your aspx page.
<script language="javascript" type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequestHandler);
prm.add_beginRequest(BeginRequestHandler);
prm.add_pageLoading(PageLoadingHandler);
prm.add_pageLoaded(PageLoadedHandler);
prm.add_endRequest(EndRequestHandler);
function InitializeRequestHandler(sender, args)
{
}
function BeginRequestHandler(sender, args)
{
}
function PageLoadingHandler(sender, args)
{
}
function PageLoadedHandler(sender, args)
{
}
function EndRequestHandler(sender, args)
{
window.status="ending request";
if (args.get_error() != undefined)
{
var errorMessage;
if (args.get_response().get_statusCode() == '12031')
{
args.set_errorHandled(true);
}
else
{
// not my error so let the default behavior happen }
}
}