Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendoui MVC EditorTemplateName do not work in PopUp edit mode

I want to use EditorTemplateName for foreign key Column in KendoUi grid.

when Grid Edit Mode is InLine all thing is OK and My Template Loaded. but when change mode to Popup not load template. how can fix it?

@(Html.Kendo().Grid<Product>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.ProductId).Visible(false);
        columns.Bound(p => p.Title);

        columns.ForeignKey(p => p.CategoryId, new SelectList(ViewBag.CategoryySelectList, "Value", "Text"))
                   .EditorTemplateName("MyTemplate");

        columns.Command(cmd => cmd.Edit());
    })
    .Editable(edit => edit
        .Mode(GridEditMode.PopUp)
    )
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(15)
        .Events(events => events.Error("error_handler"))
        .Model(model =>
        {
            model.Id(p => p.ProductId);
        })
        .Read(read => read.Action("FillGrid", "Products"))
        .Update(update => update.Action("Edit", "Products"))
        .Destroy(destroy => destroy.Action("Delete", "Products"))
    )
)
like image 664
Morteza Avatar asked Feb 16 '23 22:02

Morteza


1 Answers

The rendering is indeed not handled the same when using InLine/InCell vs. Popup. For the latter, the editor template that is actually going to be used is inferred from the name, so you'd put a Product.cshtml template in ~Views/Shared/EditorTemplates.

This article covers this in detail: http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templates.

like image 70
Jeff Avatar answered Apr 02 '23 11:04

Jeff