Cause
I was facing problem while handling the exception thrown by ajax 1.0 . I put sometime and find the following way out.
Solution
Understood that i need to add an custom event to the endRequest, this should be done in the body onload.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
Then after that we need to check whether the event arguments has an error or not. As follows
function EndRequestHandler(sender, args)
{
if (args.get_error() != undefined && args.get_error().httpStatusCode == '500')
{
//Handle the exception here.
var errorMessage = args.get_error().message
args.set_errorHandled(true);
}
}
This is a simple and very handy way to handle the exception for Ajax 1.0.
Monday, July 7, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment