Kendoui MVC EditorTemplateName不要在弹出的编辑模式下工作 [英] Kendoui MVC EditorTemplateName do not work in PopUp edit mode

查看:1569
本文介绍了Kendoui MVC EditorTemplateName不要在弹出的编辑模式下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用EditorTemplateName在KendoUi电网外键列。

当电网编辑模式是内联所有的事情是确定,我的模板加载。但是,当切换模式,弹出不加载模板。
如何解决?

@(Html.Kendo()网格和LT;产品>()
    。名称(网格)
    .Columns(列=>
    {
        columns.Bound(P => p.ProductId)。可见(假);
        columns.Bound(p值=> p.Title);        columns.ForeignKey(P => p.CategoryId,新的SelectList(ViewBag.CategoryySelectList,值,文本))
                   .EditorTemplateName(MyTemplate的);        columns.Command(CMD = GT; cmd.Edit());
    })
    .Editable(编辑=>编辑
        .Mode(GridEditMode.PopUp)
    )
    .DataSource(数据源=>数据源
        阿贾克斯()
        .PageSize(15)
        .Events(事件=> events.Error(error_handler))
        。型号(型号= GT;
        {
            model.Id(p值=> p.ProductId);
        })
        .Read(读=> read.Action(FillGrid,产品))
        .Update(更新=> update.Action(编辑,产品))
        .Destroy(破坏= GT; destroy.Action(删除,产品))
    )


解决方案

渲染确实是不使用时的处理相同的内联 / 盒内弹出。对于实际上是将要使用从名称推断,所以你放了 Product.cshtml 模板,在后,编辑模板〜查看/共享/ EditorTemplates

本文介绍了这个细节:
<一href=\"http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templates\">http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templates.

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"))
    )
)

解决方案

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.

这篇关于Kendoui MVC EditorTemplateName不要在弹出的编辑模式下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆