How to catch scriptmanager exceptions in Javascript

<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(requestEndHandler );
 
// This function will handle the end request event
function requestEndHandler(sender, args) {
   if( args.get_error() ){
      document.getElementById("errorMessageLabel").innerText = 
         args.get_error().description;
      args.set_errorHandled(true);
   }
}
 
</script>
...
 
<div id="errorMessageLabel"></div>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.