1
我想要做的是创建一个网格,当你点击它打开一个细节网格供用户选择。我创造了他们这样Kendo Ui模型绑定3级对象
@(Html.Kendo().Grid(Model.items).Name("Access")
.Columns(columns =>
{
columns.Bound("ProjId").Width(220).Title("Project #");
})
.ClientDetailTemplateId("detailTemplateId")
.Selectable()
.Events(events => events.DetailInit("initDetailGrid"))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
)
<script id="detailTemplateId" type="text/kendo-tmpl">
@(Html.Kendo().Grid(Model.items.subItems).Name("detailGrid")
.Columns(columns => columns.Bound("itemsName").Title("Select"))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
.ToClientTemplate()
)
</script>
该模型是这样的
public class ItemModel
{
public List<myItems> items;
public ItemModel()
{
items = new List<myItems>();
}
}
的myItems类别处定义创建,并且myItems类中的一个子类,这是我想的子项得到
public class myItems
{
public int ProjId;
public List<otherItems> subItems;
public myItems(){
subItems = new List<otherItems>();
}
public class otherItems()
{
public String itemsName;
public int itemId
}
}
但是当我试图在这里将它绑定@(Html.Kendo().Grid(Model.items.subItems).Name("detailGrid")
说,它不能解析符号?我是否正确地做这件事?还是必须将它绑定到项目,然后使用列模板获取列内的值?