views:

641

answers:

1

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.

A: 

have you tried wraping the ajax call in a try catch block and using the exception to get the error message?

rams

related questions