title | description | type | page_title | slug | tags | ticketid | res_type |
---|---|---|---|---|---|---|---|
Insert Button inside a Column Header Template |
An example on how to place an Add New Record button in the column header of Grid in Telerik UI for ASP.NET Core. |
how-to |
Add New Record Button in Column Header | Telerik UI for ASP.NET Core Grid |
grid-add-new-button-header-inline |
grid, add, new, button, header, inline, template, command, clientheadertemplate |
1413640 |
kb |
Product | Grid for Progress® Telerik® UI for ASP.NET Core |
Product Version | 2019.2.514 |
What is the best approach for adding a button in the Grid to the command column header which will add a new record?
-
Utilize the
ClientHeaderTemplate
property of the command column..Columns(columns => { columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250).ClientHeaderTemplate("<button id='addNew'>Add New</button>"); })
-
Initialize the Kendo UI Button and configure its
click
event. To add a new record to the Grid, use theaddRow()
method.$(document).ready(function () { $("#addNew").kendoButton({ icon: "plus", click: function (e) { e.preventDefault(); var grid = $("#grid").data("kendoGrid"); grid.addRow(); } }); });