How do you handle Server Side Exceptions on the Client Side?

2 posts, 0 answers
  1. Bob
    Bob avatar
    1 posts
    Member since:
    Dec 2009

    Posted 16 Dec 2009 Link to this post

    The RadGrid offers a clientside event called OnDataBindingFailed which gets fired on the clientside (javascript) when there is a server side exception.

    What is the equivalent for the RadAjaxPanel and RadAjaxManager? I want to be able to handle all exceptions as gracefully as possible.
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 17 Dec 2009 Link to this post

    Hello Bob,

    Generally you can handle endRequest event of PageRequestManager and see whether there is an error and handle it.
    01.Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    02.function EndRequestHandler(sender, args)
    03.{
    04.   if (args.get_error() != undefined)
    05.   {
    06.       var errorMessage;
    07.       if (args.get_response().get_statusCode() == '200')
    08.       {
    09.           errorMessage = args.get_error().message;
    10.       }
    11.       else
    12.       {
    13.           // Error occurred somewhere other than the server page.
    14.           errorMessage = 'An unspecified error occurred. ';
    15.       }
    16.       args.set_errorHandled(true);
    17.       //Show custom error dialog   
    18.   }
    19.}


    Bellow you can find more details
    http://www.asp.net/AJAX/Documentation/Live/tutorials/CustomizingErrorHandlingforUpdatePanel.aspx

    Best wishes,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top