4

KendoUiグリッドの外部キーColumnにEditorTemplateNameを使いたいです。

Grid Edit Mode が InLine の場合、すべて問題なく My Template Loaded です。ただし、モードをポップアップに変更すると、テンプレートはロードされません。どうすれば修正できますか?

@(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"))
    )
)
4

1 に答える 1

8

InLine/と を使用する場合、InCellレンダリングは実際には同じように処理されませんPopup。後者の場合、実際に使用されるエディター テンプレートは名前から推測されるため、Product.cshtmlテンプレートを .xml に配置し~Views/Shared/EditorTemplatesます。

http: //docs.kendoui.c​​om /getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templatesの記事で詳しく説明してい ます。

于 2013-08-15T13:58:37.780 に答える