New to Telerik UI for ASP.NET MVC? Download free 30-day trial
ASP.NET MVC Grid OData-v4 Batch Editing
- EXAMPLE
- VIEW SOURCE
-
Change Theme
defaultDefault Theme
- Main
- Main Dark
- Nordic
- Ocean Blue
- Ocean Blue A11Y
- Purple
- Turquoise
Bootstrap Theme- Main
- Bootstrap 3
- Bootstrap 3 Dark
- Main Dark
- Nordic
- Turquoise
- Turquoise Dark
- Urban
- Vintage
Material Theme- Main
- Arctic
- Lime Dark
- Main Dark
- Nova
Classic Theme- Main
- Green
- Green Dark
- Lavender
- Lavender Dark
- Main Dark
- Metro
- Metro Dark
- Moonlight
- Opal
- Opal Dark
- Silver
- Silver Dark
- Uniform
Fluent Theme- Main
Also available for:
CLIENT-SIDE API SERVER-SIDE APIDescription
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:
- 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 by setting
columns.Command(command => { command.Destroy(); });
. - 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. - Declare the
Create
,Read
,Update
, andDestroy
action methods in the DataSource. These methods are responsible for the manipulation of the data items. - Specify a unique field in the
Model
as theDataSource.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 and to the Kendo UI oData-v4 Service Repository.