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

Handling Callback Exceptions on the Client Side

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, use the control’s CallbackError client event to process the error at the control level, or handle the ASPxGlobalEvents control’s ASPxClientGlobalEvents.CallbackError client event to process the error globally (across all DevExpress web controls).

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.");
}