This is a migrated thread and some comments may be shown as answers.

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

1 Answer 543 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 16 Dec 2009, 04:00 PM
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.

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 Dec 2009, 07:55 AM
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.
Tags
Ajax
Asked by
Bob
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or