Show friendly message on ASP.NET Ajax error

Posted by balexandre on Stack Overflow See other posts from Stack Overflow or by balexandre
Published on 2011-01-07T12:18:28Z Indexed on 2011/01/07 14:54 UTC
Read the original article Hit count: 227

You all know how annoying is this:

alt text

I do have a log system and the correct error is well explicit there, but I want to give a better message to the user.

I keep trying several ways but I'm using Telerik components and well jQuery and I ended up using both ASP.NET Ajax methods and jQuery, so I use

function pageLoad() {

    try {
        var manager = Sys.WebForms.PageRequestManager.getInstance();
        manager.add_endRequest(endRequest);
        manager.add_beginRequest(OnBeginRequest);
        manager
    }
    catch (err) {
        alert(err);
    }
}

as well

$(document).ready(function() { ... }

that alert(err) is never fired even upon OnClick events

what's the best approach to avoid this message errors and provide a cleaner way?

all this happens in <asp:UpdatePanel> as I use that when I didn't know better (3 years ago!) and I really don't want to mess up and build all again from scratch :(

Any help is greatly appreciated


Updated with more error windows after volpav solution

alt text

alt text

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-ajax