[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Collapse]Concepts
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Collapse]Data Editing
      Edit Form
      Adding and Deleting Records
      Row Validation and Error Indication
      Edit Form Validation (Templates)
      Processing Custom Callbacks
      Batch Edit Mode
    [Expand]Data Shaping and Manipulation
    [Expand]Data Formatting
    [Expand]Master-Detail Relationship
     Appearance Customization
     Adaptivity
     Layout
    [Expand]Templates
    [Expand]Export
     Toolbars
    [Expand]ASPxGridLookup
    ASPxGridView Designer
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Tree List
  [Expand]Card View
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Scheduler
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Gauges
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Batch Edit Mode

Note

Starting from v18.2, the ASPxGridView supports callbacks in batch edit mode.

The ASPxGridView control allows you to modify grid data on the client side and then send it to the server in a single request. All user changes are maintained on the client side until a user clicks the Update or Cancel button. Set the ASPxGridViewEditingSettings.Mode property to Batch to enable the batch edit functionality.

View the Demo

To see the Batch Edit mode in action, please refer to the following online demo: Batch Editing.

Expanded Batch Edit Mode Settings

Customize the ASPxGridView's functionality in batch edit mode using the following features:

Edit mode

End-users can use in-line editors to edit data in a grid. The GridViewBatchEditSettings.EditMode property allows you to specify which control element (data cell or data row) end-users can use to edit data.

Start edit action

Set the GridBatchEditSettings.StartEditAction property to one of the following values to specify which user action invokes a data cell's in-line editor:

Cell Focusing and Keyboard Navigation

You can use keyboard to navigate through cells when the grid's GridBatchEditSettings.StartEditAction property is set to "FocusedCellClick". In this mode, click a grid data cell to focus the cell, and click it again to start cell editing.

Key Action
Arrow Keys Moves focus between cells.
Tab Moves focus to the next cell.
Shift+Tab Moves focus to the previous cell.
Enter Starts and ends editing.
F2 Starts editing.
Delete Deletes a row that contains the focused cell.

The ASPxGridView provides client-side APIs that allow you to manage the focused data cell.

Refer to the "Client-Side Functionality" and "Batch Edit Mode" sections in this topic for more information about events related to cell focusing and navigation in batch edit mode.

Preventing end-user editing

Set the column's GridColumnEditFormSettings.Visible property to false to prevent an end user from editing cells. These column cells are skipped when end users use TAB to navigate through cells. You can also use the ASPxClientGridView.BatchEditStartEditing event's ASPxClientCancelEventArgs.cancel argument to cancel editing. Refer to the ASPxGridView - Batch Editing - How to cancel editing or disable the editor conditionally online example for more information.

Confirmation on losing changes

A grid displays a "confirm" message before a grid callback or postback is performed if it contains modified data. You can use the ASPxGridTextSettings.ConfirmOnLosingBatchChanges property to customize this message's text, or set the GridBatchEditSettings.ShowConfirmOnLosingChanges property to false to disable it.

Validation

The ASPxGridView allows you to validate grid data on the client side in batch edit mode. Use the ASPxClientGridView.BatchEditRowValidating event to specify whether an end user's changes are valid.

Set the GridBatchEditSettings.AllowValidationOnEndEdit property to one of the following values to specify when to fire the ASPxClientGridView.BatchEditRowValidating event.

  • true - In this default settings, the control checks edited data cell/row when an in-line editor loses focus.
    The ValidationSettings.SetFocusOnError property is not in effect in batch edit mode if the input value fails validation and needs to re-focus an editor. Instead, set the GridBatchEditSettings.AllowEndEditOnValidationError property to false to focus the editor until an end user enters the correct value.
  • false - In this case, the control checks all edited data cells/rows when an end user clicks the Update button.

To validate grid data programmatically, use the ASPxClientGridViewBatchEditApi.ValidateRow method for the specified data row/cell and the ASPxClientGridViewBatchEditApi.ValidateRows method for all displayed data.

See the T171182: ASPxGridView - How to implement custom date validation in Batch Edit mode code example that illustrates how to validate grid data in batch edit mode.

Data Item Template

ASPxGridView supports templates in batch edit mode. The ASPxGridView provides a set of API members to help process data cells’ content specified in data item templates.

The following code example demonstrates how to use the described API resources: T506160: How to use and modify a control placed in the DataItemTemplate.

In Batch Edit mode, use the DataItemTemplate only to customize the appearance as the grid copies only a row's HTML markup when creating a new row.

Preview changes before saving

You can preview and modify inserted, deleted and edited rows before you click the "Update" button and the control sends these changes to the server.

Set the GridViewBatchEditSettings.KeepChangesOnCallbacks property to true to show the "Show changes" button. This button allows you to display modified rows grouped by user operation type (delete, add, edit) and modify them. The "Save changes" or "Cancel changes" buttons allow you to end batch editing and save/cancel changes. To close the Changes Preview mode and display all grid rows (including modified ones), click "Hide changes".

To customize the grid in Changes Preview mode, you can override the .dxgvBECP CSS class.

Note

The ASPxGridView supports adaptivity in Preview Changes mode.

Expanded Appearance Customization

The ASPxGridView highlights all modified values in batch edit mode.

You can use the following properties to customize data cells'/rows' appearance:

You also can remove deleted data rows from the grid instead of highlighting them. To do this, set the GridViewBatchEditSettings.HighlightDeletedRows property to false.

The grid displays the Update and Cancel buttons in the status bar. You can use the status bar's style settings to change these buttons' appearance.

The following code snippets illustrate how to hide the Update and Cancel buttons:

  • Using the ASPxGridSettings.ShowStatusBar property.

  • Modifying the grid's dxgvStatusBar CSS class.

Expanded Client-Side Functionality

The ASPxClientGridView.batchEditApi property provides access to the batch edit client API. The tables below list the API resources that you can use to invoke grid commands on the client-side:

Start editing
Member Description
ASPxClientGridView.StartEditRow Invokes in-line editors in a specified row.
ASPxClientGridViewBatchEditApi.StartEdit Invokes the in-line editor in a specified cell.
Add/Delete row
Member Description
ASPxClientGridView.AddNewRow Adds a new row. Does not perform a callback in batch edit mode.
ASPxClientGridView.DeleteRow Deletes the specified row.
ASPxClientGridViewBatchEditApi.IsNewRow Indicates if the row with the specified visible index was created.
ASPxClientGridViewBatchEditApi.IsDeletedRow Indicates if the row with the specified visible index was deleted.
Finish editing
Member Description
ASPxClientGridViewBatchEditApi.EndEdit Ends cell or row editing.
ASPxClientGridView.UpdateEdit Ends cell or row editing and sends all changes to the server.
ASPxClientGridViewBatchEditApi.ResetChanges Resets all unsaved changes in a specified row/cell.
ASPxClientGridView.CancelEdit Cancels all changes and switches the grid to browse mode.

Cell Focusing and Navigation

Member Description
ASPxClientGridView.GetFocusedCell Returns information about the focused cell.
ASPxClientGridView.SetFocusedCell Focuses the specified cell.
ASPxClientGridViewBatchEditApi.MoveFocusBackward Moves focus to the previous cell in the row.
ASPxClientGridViewBatchEditApi.MoveFocusForward Moves focus to the next cell in the row.

Changes Preview

Member Descriuption
ASPxClientGridViewBatchEditApi.ShowChangesPreview Swithches the grid to Changes Preview mode.
ASPxClientGridViewBatchEditApi.HideChangesPreview Closes the Changes Preview mode and displays all grid rows (including modified rows).

Note that there are client-side methods that are not in effect in batch edit mode. See the Batch Edit Mode Limitations - Unsupported client-side API topic for more information.

Expanded Batch Edit Mode Events

The ASPxGridView provides a set of events that allow you to perform custom actions when end users interact with the grid in batch edit mode.

Server-side events

The ASPxGridBase.BatchUpdate event allows you to implement a custom data updating mechanism. The event fires when an end user clicks the Update button or calls the ASPxClientGridView.UpdateEdit method; the ASPxGridBase.BatchUpdate event handler receives an argument containing information about the changed values.

The ASPxGridView raises the ASPxGridView.FocusedRowChanged event when an end user moves focus from one row to another or after the ASPxGridView.FocusedRowIndex property's value was changed in code.

Client-side events

The ASPxClientGridView provides a set of the client-side methods listed in the following tables:

Expanded Batch Edit Mode Limitations

There are ASPxGridView control features and API members that are not in effect in batch edit mode. All user changes are stored on the client-side.

Unsupported features

The features below are not supported when the grid is in batch edit mode:

Unsupported server-side API

The following ASPxGridView members are not in effect when the grid is in batch edit mode:

You can use the client-side API instead of the unsupported server-side API to implement the tasks listed above.

Unsupported client-side API

The following members of the ASPxClientGridView are not in effect when the grid is in batch edit mode:

The ASPxClientGridView.GetTopVisibleIndex property does not return the correct values if rows were deleted/inserted. Use the ASPxClientGridViewBatchEditApi.GetRowVisibleIndices instead.

Expanded Code Examples

Expanded See Also

Is this topic helpful?​​​​​​​