R – How to pass server-side error messages to ASP.NET Ajax client

asp.net-ajaxtelerik

An example scenario:

  1. User performs an update, for example a drag & drop. This is an ajax request.
  2. Server-side code cannot validate the update or the operation just fails. An exception is thrown.
  3. A reasonable error message should be shown to the user.

How should I communicate the exception to the client side and show the error message in a div message box?

The message should be shown after the fact. Sometimes it is possible to prevent errors in client-side code but I'm not concerned about this.

With traditional data binding in the code behind file I can show a label after an error condition. But if the Ajax control is connected to a provider class specified in the aspx, I don't see how this would be possible. Only option I can think of is to catch server-side exceptions in client-side code. Is this possible?

I'm using Telerik RadControls for ASP.NET Ajax.

Best Answer

You can try adding the error,handler directly in Ajax framework like this:

http://encosia.com/how-to-improve-aspnet-ajax-error-handling/

Related Topic