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

Prevent Grid Popup Editor from Closing on Update and Create


Product Progress Telerik UI for ASP.NET Core Grid
Progress Telerik UI for ASP.NET Core version Created with the 2023.2.829 version


How can I keep the popup editor of the Telerik UI for ASP.NET Core Grid open after I update or insert a record?


To achieve the desired scenario:

  1. Handle the Edit event of the Grid and attach an event handler for the close event of the Popup window.
  2. In the close handler, the e.preventDefault() method will be called to prevent the popup from closing.
  3. To allow the user to close the editor, set a preventCloseOnSave flag when the Cancel and Close buttons are clicked.
  4. Contrary to the previous step, subscribe to the Save event of the Grid and reset the flag.
    .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);
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .Events(ev => {
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Model(model => model.Id(p => p.ProductID))
        .Create(update => update.Action("EditingPopup_Create", "Grid"))
        .Read(read => read.Action("EditingPopup_Read", "Grid"))
        .Update(update => update.Action("EditingPopup_Update", "Grid"))
        .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
    <script type="text/javascript">
        var preventCloseOnSave = false;

        function onSave(e) {
            preventCloseOnSave = true;
        var onWindowEditClose = function (e) {
            if (preventCloseOnSave) {
                preventCloseOnSave = false;

        function onEdit(e) {
             var editWindow ="kendoWindow");
             editWindow.bind("close", onWindowEditClose);

            $(".k-grid-cancel").on("mousedown", function (e) {

                preventCloseOnSave = false;

More ASP.NET Core Grid Resources

See Also

In this article