Skip to main content

Handle a Callback Exception on the Client Side

DevExpress controls allows you to handle their callbacks on the client in two ways: process a particular control’s exception or process exceptions globally for all DevExpress web controls.

Handle Exceptions of a Particular Control

Handle the CallbackError event to process a control’s callback exceptions. Use the event argument message property to get the error description. Set the handled property to true to prevent further processing of the exception. In this case, the ASPxClientGlobalEvents.CallbackError event does not fire and the default exception message is not displayed.

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

Handle Exceptions of Every DevExpress Control

Handle the ASPxClientGlobalEvents.CallbackError client event to process callback exceptions globally for all DevExpress web controls.

<dx:ASPxGlobalEvents ID="ASPxGlobalEvents1" runat="server" >
    <ClientSideEvents CallbackError="function(s, e) {
        alert('A DevExpress control throws the following exception: ' + e.message)
    }" />