A new event was added to all of our ASP.NET controls that use callbacks. The CallbackError event handler is a client-side event and can be used to handle those pesky callback errors. This event captures and displays callback errors using the client-side JavaScript. The event still require the use of an ASPxHttpHandler module, which is responsible for intercepting the callback error. However, this event now gives you the choice of displaying the error on the client side.
To use it, override the event using the smart tag of the control or you can add the event code using source HTML view. Here is an example that shows how the ASPxGridView will use a JavaScript alert popup to display the error message:
<dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False"
CssFilePath="~/App_Themes/Plastic Blue/{0}/styles.css" CssPostfix="PlasticBlue"
DataSourceID="SqlDataSource1">
<ClientSideEvents
CallbackError="function(s, e) {
alert(e.message);
e.handled = true;
}" />
With this new event, there are now three different way to handle and respond to callback errors:
- Server side – Respond to the control
- Server side – Redirect to a general error page
- Client side
Which method do you prefer to respond to callback errors with?
Free DevExpress Products – Get Your Copy Today
The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the
DevExpress Support Center at your convenience. We’ll be happy to follow-up.