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

ASPxClientNavBar.CallbackError Event

Fires on the client if any server error occurs during server-side processing of a callback sent by the ASPxClientNavBar.

Declaration

CallbackError: ASPxClientEvent<ASPxClientCallbackErrorEventHandler<ASPxClientNavBar>>

Event Data

The CallbackError event's data class is ASPxClientCallbackErrorEventArgs. The following properties provide information specific to this event:

Property Description
handled Gets or sets whether the event is handled and the default error handling actions are not required.
message Gets the error message that describes the server error that occurred.

Remarks

The CallbackError event enables you to properly respond to a server error occurring as a result of a callback being processed on the server side. You can handle this event to perform specific client-side actions, such as displaying explanatory text or image related to the error, for example.

Typically, a server error, which occurs during server-side processing of a callback, leads to web application hanging, because, in this case, no proper response is generated for a control that initiated the callback. However, AJAX-enabled web controls from the DevExpress product line are able to automatically catch server errors occurring within handlers of their server-side events, and to pass the related error information to the client for further processing through the CallbackError event’s argument.

See Handling Callback Exceptions on Client to learn more.

Example

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

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" 
Inherits="_Default" %>
<%@ Register assembly="DevExpress.Web.v8.3, Version=8.3.2.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxNavBar" tagprefix="dxnb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Page_Load(object sender, EventArgs e){
    }
    protected void ASPxNavBar1_ExpandedChanged(object source, 
      DevExpress.Web.NavBarGroupEventArgs e) {
        throw new Exception("A new exception.");
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <dxnb:ASPxNavBar ID="ASPxNavBar1" runat="server" AutoCollapse="True" 
            EnableCallBacks="True" onexpandedchanged="ASPxNavBar1_ExpandedChanged" 
            Width="252px">
            <Groups>
                <dxnb:NavBarGroup Text="Products">
                    <Items>
                        <dxnb:NavBarItem Text="ASP.NET Components">
                        </dxnb:NavBarItem>
                        <dxnb:NavBarItem Text=".NET WinForms Components">
                        </dxnb:NavBarItem>
                        <dxnb:NavBarItem Text="VCL Components">
                        </dxnb:NavBarItem>
                    </Items>
                </dxnb:NavBarGroup>
                <dxnb:NavBarGroup Expanded="False" Text="Support">
                    <Items>
                        <dxnb:NavBarItem Text="Client Center">
                        </dxnb:NavBarItem>
                        <dxnb:NavBarItem Text="Online Help">
                        </dxnb:NavBarItem>
                        <dxnb:NavBarItem Text="Contacts">
                        </dxnb:NavBarItem>
                    </Items>
                </dxnb:NavBarGroup>
            </Groups>
            <ClientSideEvents CallbackError="function(s, e) {
        if (e.message=='A new exception.') {
        alert('The CallbackError event is raised!'); }
            }" />
        </dxnb:ASPxNavBar>

    </div>
    </form>
</body>
</html>
See Also