An example scenario:
- User performs an update, for example a drag & drop. This is an ajax request.
- Server-side code cannot validate the update or the operation just fails. An exception is thrown.
- 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.