I am attempting to call a function in the controller when the Destroy button is clicked on a row. The controller will then delete the record in the database. I also need to pass in the ID of the employee to identify which record in the database to delete. Thank you!
This is what I have:
@(Html.Kendo().Grid<
TelerikAspNetCoreApp1.Models.EmployeeViewModel
>()
.Name("grid")
.ToolBar(toolbar => toolbar.Create().Text("ADD").HtmlAttributes(new { title = "Add Employee" }))
.Columns(columns =>
{
columns.Bound(p => p.EmployeeName);
columns.Bound(p => p.Active);
columns.Command(command =>
{
command.Destroy().HtmlAttributes(new { title = "Delete Highlighted Employee" });
}).Width(150);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:450px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Employee_Read", "Grid"))
.Destroy(update => update.Action("Employee_Delete", "Grid"))
)
)