New to Telerik UI for ASP.NET MVC? Download free 30-day trial

ASP.NET MVC Grid Batch Editing

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
editing.cshtml
EditingController.cs
ProductService.cs

Also available for:

CLIENT-SIDE API SERVER-SIDE API

Description

The Telerik UI for ASP.NET MVC Grid comes with an editing feature, which enables users to edit the content of its cells by simply clicking on them. As a result, the modified data on the client is processed by the component on the server in a single-batch update.

This demo shows how to implement editing in the Data Grid by using its built-in batch create, update, and destroy commands.

To enable the batch data-editing functionality of the Data Grid:

  1. Turn on the in-cell editing by setting .Editable(editable => editable.Mode(GridEditMode.InCell)).
  2. Add the Create, Cancel, and SaveChanges buttons to the toolbar by setting .ToolBar(toolbar => { toolbar.Create(); toolbar.Save(); }.
  3. To enable the Delete command on each row, insert a new column by setting columns.Command(command => { command.Destroy(); });.
  4. Set the .Batch(true) and .ServerOperation(false) properties in the DataSource declaration to enable batch updates and perform the paging, sorting, filtering, and grouping operations on the client.
  5. Declare the Create, Read, Update, and Destroy action methods in the DataSource. These methods are responsible for the manipulation of the data items.
  6. Specify a unique field in the Model as the DataSource.Model.Id.

Once the cells are edited, you can process the changes or discard them. To switch the edit mode foe a cell, click on a cell. To process or discard all changes at once, use the Save changes or Cancel changes buttons.

For more information about the editing capabilities, refer to the official Telerik UI for ASP.NET MVC Data Grid product documentation on the available batch editing approaches.

Additional Apps

This Grid example is part of a unique collection of hundreds of ASP.NET MVC demos, with which you can see all Telerik ASP.NET MVC components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in the ThemeBuilder.

Support & Learning Resources

Additional Resources