ASP.Net - Ajax Error handling

By [)ia6l0 iii

You can handle errors in ASP.Net Ajax web pages using some Javascript code.

<script language="javascript" type="text/javascript">
    
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, args)
    {
        if (args.get_error() != undefined)
{
        
   //show the error message
alert(args.get_error().message);
//Mark the error as handled.
            args.set_errorHandled(true);
        }
    });     
</script>

Related FAQs

You can avoid recompiling the entire website if certain files are changed. These files include dll files in the Bin folder, Global.asax and App_Code folders.
Use the Trace attribute under System.Web section to turn on trace information. Set the value of pageOutput to true. This would add the trace information to the bottom of the Web page.
The compilation element lets you control many compiler settings. The following are few important attributes.
The <%= expressions are evaluated during render, and the <%# expressions are evaluated during the DataBind
Use one of the three techniques mentioned below.
The primary differenct between ASP and ASP.NET is that the former is code that is interpreted by a Script Engine and the latter is a compiled code running on a web server.
ASP.Net - Ajax Error handling  (1049 Views)