By default on error during async request UpdatePanel shows an annoying alert messagebox. There is a way to avoid that and handle errors on your own. Here is how to handle errors in ASP.NET AJAX (This is not only for UpdatePanels). The trick is to add handler to endRequest to the PageRequestManager:
<script type="text/javascript">
function EndRequestHandler( sender, args )
{
if ( args.get_error() != undefined )
{
// set error is handled in order to avoid the messagebox
args.set_errorHandled( true );
}
}
function AppLoad()
{
Sys.WebForms.PageRequestManager.getInstance().add_endRequest( EndRequestHandler );
}
Sys.Application.add_load( AppLoad );
</script>
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment