This example shows the cell editting mode combined with batch updates. To enter edit mode just click a cell.

To enable cell editing with batch updatesyou need to do the following:

  1. Set the edit mode to GridEditMode.InCell:
    <%= Html.Telerik().Grid<EditableProduct>()
            .Name("Grid")
            .Editable(editing => editing.Mode(GridEditMode.InCell))
    %>
    
  2. Add "Insert" and "Submit changes" commands to the grid toolbar:
    <%= Html.Telerik().Grid<EditableProduct>()
            .Name("Grid")
            .ToolBar(commands => {
                commands.Insert();
                commands.SubmitChanges();
            })
            
            .Editable(editing => editing.Mode(GridEditMode.InCell))
    %>
    
    
  3. Specify an action method which will handle the batch update request (batch updates are NOT supported in server binding mode):
    <%= Html.Telerik().Grid<EditableProduct>()
            .Name("Grid")
            .DataKeys(keys => 
            {
                keys.Add(p => p.ProductID);
            })
            .ToolBar(commands => {
                commands.Insert();
                commands.SubmitChanges();
            })
            .DataBinding(dataBinding =>
                dataBinding.Ajax()
                    .Select("_SelectBatchEditing", "Grid")
                    .Update("_SaveBatchEditing", "Grid")
            )
            .Editable(editing => editing.Mode(GridEditMode.InCell))
    %>
    
  4. Implement the batch update in the specified controller method:
    public ActionResult _SaveBatchEditing([Bind(Prefix = "inserted")]IEnumerable<EditableProduct> insertedProducts,
                [Bind(Prefix = "updated")]IEnumerable<EditableProduct> updatedProducts, 
                [Bind(Prefix = "deleted")]IEnumerable<EditableProduct> deletedProducts)
    {
        if (insertedProducts != null)
        {
            foreach (var product in insertedProducts)
            {
                // perform insert
            }
        }
    
        if (updatedProducts != null)
        {
            foreach (var product in updatedProducts)
            {
                //perform update
            }
        }
    
        if (deletedProducts != null)
        {
            foreach (var product in deletedProducts)
            {
                //perform update
            }
        }
        
        return View(new GridModel(SessionProductRepository.All()));
    }