Skip to main content
Tab

GridBatchEditSettings.ShowConfirmOnLosingChanges Property

Specifies whether the grid control displays the Confirmation dialog box to avoid losing unsaved changes.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(true)]
public bool ShowConfirmOnLosingChanges { get; set; }

Property Value

Type Default Description
Boolean true

true to display the Confirmation dialog box; otherwise, false.

Remarks

In batch edit mode, the grid control allows a user to modify batches of grid data and send it to the server in a single request. To avoid losing unsaved modified data, the control shows the Confirmation dialog box. A user can confirm the action and lose the modified data or cancel the action, save changes, and repeat the action.

The grid control displays the Confirmation dialog box in the following cases:

  • A user reloads or leaves the page.

    Grid.BatchEditMode - ConfirmOnLeavingSite

  • On callbacks and postbacks. Note that ASPxGridView shows the Confirmation dialog box on callbacks when the KeepChangesOnCallbacks property is disabled.

    Grid.BatchEditMode - ConfirmationMessage

To customize the Confirmation dialog text, specify the ASPxGrid.SettingsText.ConfirmOnLosingBatchChanges property (the ASPxTreeList.SettingsText.ConfirmOnLosingBatchChanges property for ASPxTreeList).

The grid allows you to use one of the following options to disable the Confirmation dialog box:

  • Set the ShowConfirmOnLosingChanges property to false. In this case, the grid control does not show the Confirmation dialog box and loses unsaved changes.

    <dx:ASPxGridView ID="ASPxGridView1" runat="server" KeyFieldName="ProductID">
        <%--...--%>
        <SettingsEditing Mode="Batch">
            <BatchEditSettings ShowConfirmOnLosingChanges ="false" />
        </SettingsEditing>
    </dx:ASPxGridView>
    
  • Set the cancel argument property to true in the client-side BatchEditConfirmShowing event handler (ASPxClientGridView.BatchEditConfirmShowing, ASPxClientCardView.BatchEditConfirmShowing, ASPxClientVerticalGrid.BatchEditConfirmShowing, ASPxTreeList.BatchEditConfirmShowing). In this case, the grid control does not show the Confirmation dialog box and keeps changes on callbacks and postbacks.

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

For more information on batch edit mode in a particular control, refer to the following topics:

Limitations

  • For ASPxTreeList, the false value of the ShowConfirmOnLosingChanges property does not disable the Confirmation dialog box that the control displays when a user leaves the page.

  • iOS devices do not display the Confirmation dialog box when a user leaves the page.

Online Demos

Run Demo: ASPxGridView - Batch Editing and Updating

Run Demo: ASPxCardView - Batch Editing and Updating

Run Demo: ASPxVerticalGrid - Batch Editing and Updating

Run Demo: ASPxTreeList - Batch Editing and Updating

See Also