New to Telerik UI for ASP.NET Core? Start a free 30-day trial
Creating Duplicate Grid Rows
Updated on Dec 10, 2025
Environment
| Product Version | 2021.3.1109 |
| Product | Telerik UI for ASP.NET Core Grid |
Description
How can I create a copy of a Grid row when the user clicks a button?
Solution
- Create a
custom command buttonand provide a handler inside theclickmethod. - Initialize the
clickhandler. - In the
clickhandler, get the current table row and the data item bound to it through thedataitemmethod. - Add a new record to the grid
dataSourcewith the corresponding properties of the current data item.
Razor
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice).Width(100);
columns.Bound(p => p.UnitsInStock).Width(100);
columns.Bound(p => p.Discontinued).Width(100);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
columns.Command(c => c.Custom("Add duplicate row").Click("onClickHandler")).Width(200);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine).CreateAt(GridInsertRowPosition.Top))
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Events(events => events.Error("error_handler"))
.Model(model => model.Id(p => p.ProductID))
.Create(update => update.Action("EditingInline_Create", "Grid"))
.Read(read => read.Action("EditingInline_Read", "Grid"))
.Update(update => update.Action("EditingInline_Update", "Grid"))
.Destroy(update => update.Action("EditingInline_Destroy", "Grid"))
)
)For more information on how to implement the suggested approach, refer to the following Telerik REPL example.