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

Batch editing

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
  • Edit in Theme Builder
  • editing.cshtml
  • EditingController.cs
  • ProductService.cs
  • ProductViewModel.cs

Also available for:

API REFERENCE

Description

A common scenario is to switch grid cells to edit mode by simply clicking on them, update the data on the client and then process all changes on the server in a single batch update.

This demo shows how this can be accomplished using the built-in batch create, update and destroy commands of the Telerik for ASP.NET Core Grid.

To enable the batch data editing functionality:

  • Turn on the in-cell editing by setting:.Editable(editable => editable.Mode(GridEditMode.InCell))
  • Add the Create, Cancel and SaveChanges buttons to the toolbar by setting: .ToolBar(toolbar => { toolbar.Create(); toolbar.Save(); }
  • To enable the Delete command on each row insert a new column: columns.Command(command => { command.Destroy(); });
  • Set .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.
  • Declare the Create, Read, Update and Destroy action methods in the DataSource. These methods are responsible for the data items manipulation.
  • Specify a unique field in the Model as the DataSource Model Id

Once the cells are edited you have the option to process the changes or discard them. Click on a cell to place it in edit mode. Use the Save changes or Cancel changes buttons to process/discard all changes at once.

Check the documentation for step by step instructions on theTelerik Grid for ASP.NET Core Batch Editing

More about theTelerik Grid for ASP.NET Core

Support & Learning Resources