我是 MVC 和 Kendo UI 的新手,使用 Kendo UI MVC 使用 Ajax 绑定创建网格,并使用编辑器模板在一个列中添加组合框。当我在组合框中选择时,它将在列(DistDetSubName)中显示 DataValueField,但列 DistDetID 不显示任何内容..如何在此列(DistDetID)中获取 DataTextField 组合框?
列中带有编辑器模板的网格,如下面的代码:
columns.Bound(e => e.BatNbr).Hidden(true);
columns.Bound(e => e.RecordID).Hidden(true);
columns.Bound(e => e.DistDetID).EditorTemplateName("test");
columns.Bound(e => e.DistDetSubName);
编辑器模板文件夹中 test.cshtml 中的代码:
@model string
@(Html.Kendo().ComboBox()
.Name("DistDetSubName")
.DataTextField("DistDetID")
.DataValueField("DistDetSubName")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetDist", "DM");
})
.ServerFiltering(false);
})