New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Customizing the Confirmation Window in the Grid


Product Progress Telerik UI Grid for ASP.NET MVC
Progress Telerik UI version 2021.3.1207


How can I customize a confirmation dialog in the Telerik UI for ASP.NET MVC Grid?


The following example demonstrates how to customize the default Delete confirmation alert box.

To achieve this behavior, use the Window Component, a Kendo UI template, and the remove dataSource method of the Telerik UI for ASP.NET MVC Grid:

  1. Add a custom Delete command to the Grid.
  2. Define a Kendo Template to show a customized message based on the dataItem being deleted.
  3. In the handler of the custom command's click event, initialize a Window and set its content.
  4. Attach another click event to the confirmation button, then use the Grid's DataSource remove method to delete the item.

Refer to this REPL sample to review the behavior of the snippet below.

        .Title("Are you sure you want to delete this record?")
    <script type="text/x-kendo-template" id="windowTemplate">
        <p> Delete <strong>#= ProductName #</strong> ? </p>
        <p> We have #= UnitsInStock # units in stock. </p>
        <button class="k-button" id="yesButton">Yes</button>
        <button class="k-button" id="noButton"> No</button>

        .Columns(columns => {
            columns.Bound(p => p.ProductName);
            columns.Bound(p => p.UnitPrice).Width(140);
            columns.Bound(p => p.UnitsInStock).Width(140);
            columns.Bound(p => p.Discontinued).Width(100);
            columns.Command(command => {
        .ToolBar(toolbar => {
        .Editable(editable => editable.Mode(GridEditMode.InCell))
        .DataSource(dataSource => dataSource
            .Schema(schema => schema.Model(m => m.Id(p => p.ProductID)))
            .Transport(transport =>
                transport.Read(read =>
                transport.Create(create =>
                transport.Update(update =>
                transport.Destroy(destroy =>
        var windowTemplate = kendo.template($("#windowTemplate").html());
        function parameterMap(options, operation) {
            if (operation !== "read" && options.models) {
                return { models: kendo.stringify(options.models) };
        function onDelete(e){
            //click event listener on the delete button
            e.preventDefault(); //prevent page scroll reset
            var tr = $("tr"); //get the row for deletion
            var data = this.dataItem(tr); //get the row data so it can be referred later
            var window = $("#window").data("kendoWindow"); //get the client-side instance of the Window
            window.content(windowTemplate(data)); //send the row data object to the template and render it
                var grid = $("#Grid").data("kendoGrid");
                grid.dataSource.remove(data)  //prepare a "destroy" request
                grid.dataSource.sync()  //actually send the request (might be ommited if the autoSync option is enabled in the dataSource)

More ASP.NET MVC Grid Resources

See Also

In this article