Mor*_*eza 4 asp.net-mvc kendo-ui kendo-grid kendo-combobox kendo-asp.net-mvc
我想在KendoUi网格中使用EditorTemplateName作为外键.
当网格编辑模式为InLine时,一切正常,我的模板已加载.但当更改模式为Popup时不加载模板.怎么解决呢?
@(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"))
)
)
Run Code Online (Sandbox Code Playgroud)
使用InLine/ InCellvs. 时,渲染的处理方式确实不同Popup.对于后者,实际将要使用的编辑器模板是从名称推断出来的,因此您需要输入Product.cshtml模板~Views/Shared/EditorTemplates.
本文详细介绍了这一点:http: //docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-templates.
| 归档时间: |
|
| 查看次数: |
17035 次 |
| 最近记录: |