Skip to main content

ASPxClientGridView.BatchEditConfirmShowing Event

Fires before the grid shows the Confirmation dialog box.

Declaration

BatchEditConfirmShowing: ASPxClientEvent<ASPxClientGridViewBatchEditConfirmShowingEventHandler<ASPxClientGridView>>

Event Data

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

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
requestTriggerID Gets the client identifier of an object that initiates a send request.

Remarks

ASPxGridView displays the Confirmation dialog box in the following cases:

  • On callbacks if the KeepChangesOnCallbacks property is disabled.
  • A user reloads or leaves the page.
  • On postbacks.

In the BatchEditConfirmShowing event handler, set the cancel argument property to true to hide the Confirmation dialog box and keep changes on callbacks and postbacks.

<dx:ASPxGridView ID="ASPxGridView1" runat="server" KeyFieldName="ProductID"
    ClientInstanceName="grid">
    <%--...--%>
    <SettingsEditing Mode="Batch" />
    <ClientSideEvents BatchEditConfirmShowing="Grid_BatchEditConfirmShowing" />
</dx:ASPxGridView>
function Grid_BatchEditConfirmShowing(s, e) {
    e.cancel = true;
}

To allow the grid to lose unsaved changes without user confirmation, use one of the following options:

  • Call the client-side ResetChanges(visibleIndex) method in the BatchEditConfirmShowing event handler.

    function Grid_BatchEditConfirmShowing(s, e) {
        e.cancel = true;
        var items = grid.batchEditApi.GetRowVisibleIndices(true);
        items.forEach(item => grid.batchEditApi.ResetChanges(item));
    }
    
  • Set the ShowConfirmOnLosingChanges property to false.

    <dx:ASPxGridView ID="ASPxGridView1" runat="server" KeyFieldName="ProductID">
        <%--...--%>
        <SettingsEditing Mode="Batch">
            <BatchEditSettings ShowConfirmOnLosingChanges ="false" />
        </SettingsEditing>
    </dx:ASPxGridView>
    

For more information on batch edit mode in the grid, refer to the following topic: ASPxGridView - Batch Edit Mode.

Handle the BatchEditConfirmShowing Event on Callbacks That Another Control Sends

The following functionality is available when the KeepChangesOnCallbacks property is disabled:

If another control (for instance, ASPxCallbackPanel) contains ASPxGridView and sends a callback to the server, the grid can raise the BatchEditConfirmShowing event and show the Confirmation dialog box to avoid losing unsaved changes.

In the BatchEditConfirmShowing event handler, use the requestTriggerID argument property to identify the control that performs a callback and set the cancel argument property to true to hide the Confirmation dialog box on such a callback.

<dx:ASPxCallbackPanel ID="MyCallbackPanel" runat="server" ClientInstanceName="callbackPanel">
    <PanelCollection>
        <dx:PanelContent>
            <dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="grid">
                <%--...--%>
                <SettingsEditing Mode="Batch">
                    <BatchEditSettings KeepChangesOnCallbacks="False" />
                </SettingsEditing>
                <ClientSideEvents BatchEditConfirmShowing="Grid_BatchEditConfirmShowing" />
            </dx:ASPxGridView>
        </dx:PanelContent>
    </PanelCollection>
</dx:ASPxCallbackPanel>
function buttonClick() {
    callbackPanel.PerformCallback();
}

function Grid_BatchEditConfirmShowing(s, e) {
    if(e.requestTriggerID === "MyCallbackPanel")
        e.cancel = true;
}
See Also