Skip to main content

ASPxClientGridView.BatchEditChangesSaving Event

Fires before the grid saves batch changes and allows you to discard them.

Declaration

BatchEditChangesSaving: ASPxClientEvent<ASPxClientGridViewBatchEditChangesSavingEventHandler<ASPxClientGridView>>

Event Data

The BatchEditChangesSaving event's data class is ASPxClientGridViewBatchEditChangesSavingEventArgs. 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.
deletedValues Gets a hashtable that maintains information about deleted cells.
insertedValues Gets a hashtable that maintains information about inserted cells.
updatedValues Gets a hashtable that maintains information about updated cells.

Remarks

The grid raises the client-side BatchEditChangesSaving event in the following cases:

  • A user clicks the Save Changes command button.
  • You call the grid’s client-side UpdateEdit method.

In the event handler, you can obtain information about inserted, deleted, and updated data on all pages in the grid. To discard the pending changes, set the cancel argument property to true.

<dx:ASPxGridView ID="ASPxGridView1" runat="server" KeyFieldName="ProductID">
    <%--...--%>
    <SettingsEditing Mode="Batch" />
    <ClientSideEvents BatchEditChangesSaving="OnBatchEditChangesSaving" />
</dx:ASPxGridView>
function OnBatchEditChangesSaving(s, e) {
    var updatedRowCount = 0;
    var deletedRowCount = 0;
    var insertedRowCount = 0;
    // Get the number of updated rows
    for (var i in e.updatedValues) // 'i' is a row's index
        updatedRowCount++;
    // Get the number of deleted rows
    for (var i in e.deletedValues)
        deletedRowCount++;
    // Get the number of inserted rows
    for (var i in e.insertedValues)
        insertedRowCount++;
    alert(`Updated: ${updatedRowCount}, deleted: ${deletedRowCount}, inserted: ${insertedRowCount}.`);

    // Cancel the current save operation
    e.cancel = true;
}

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

See Also