Skip to main content
A newer version of this page is available. .

Handling Callback Exceptions on Client

A DevExpress ASP.NET Ajax-enabled control automatically catches server exceptions that occur within its server-side event handler, and passes corresponding error information to the client for processing. On the client side, the error is processed at the control level (via the control’s CallbackError client event) or centrally across DevExpress web controls (by handling the ASPxGlobalEvents control’s ASPxClientGlobalEvents.CallbackError client event).

Handle either of these client events to perform specific client-side actions, such as to display explanatory text or an image related to the error.

Example

This example demonstrates how to use the ASPxClientNavBar.CallbackError event to process a server error.

<dx:ASPxNavBar ID="ASPxNavBar1" runat="server" AutoCollapse="True" EnableCallBacks="True"
    OnExpandedChanged="ASPxNavBar1_ExpandedChanged" Width="252px">
    <Groups>...</Groups>
    <ClientSideEvents CallbackError="function(s, e) {
        if (e.message=='A new exception.') {
            alert('The CallbackError event is raised!'); }
    }" />
</dx:ASPxNavBar>
protected void ASPxNavBar1_ExpandedChanged(object source, DevExpress.Web.NavBarGroupEventArgs e) {
    throw new Exception("A new exception.");
}