我的kendo网格如下所示:
@(Html.Kendo().Grid<TEAMS_PP.Entity.Scoring>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.Code).Title("Code");
columns.Bound(c => c.Correlated_To).Title("Correlated To");
})
.Pageable()
.Sortable()
.Scrollable(scr=>scr.Height(430))
.Filterable()
.ClientDetailTemplateId("grdScoringTemplate")
.BindTo(ViewBag.ScoringList)
)我的ClientTemplateId代码如下:
<script type="text/x-kendo-tmpl" id="grdScoringTemplate">
<div>
<table>
<tr>
<td>
#: Code #
</td>
<td>
#: Correlated_To #
</td>
</tr>
</table>
<div>
</script>但是它没有被正确地绑定。

它应该如下所示:

问题是什么?
它没有根据客户端模板绑定网格。
发布于 2014-06-13 01:09:57
这个链接有望对初学者有所帮助:http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/client-detail-template
但很快我会建议将模板的声明从:
<script type="text/x-kendo-tmpl" id="grdScoringTemplate">至
<script type="text/x-kendo-template" id="grdScoringTemplate">发布于 2014-06-13 04:40:59
我认为问题出在您命名细节表的方式上。详细信息表不知道它应该使用哪个父记录作为详细信息。首先,我也会使用一个Kendo网格作为细节,而不是一个普通的表格。我的代码看起来是这样的。
@(Html.Kendo().Grid<OMSWeb.Models.OrderGridViewModel>()
.Name("grid")
.HtmlAttributes(new { style = "width:115%;font-size:10px;line-height:2em" })
.Columns(columns =>
{
//columns
})
.Selectable(s => s.Mode(GridSelectionMode.Single).Type(GridSelectionType.Cell))
.Pageable() // Enable paging
.Sortable() // Enable sorting
.ClientDetailTemplateId("OrderDetailsAll")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("Get", "Order"))
))
<script id="OrderDetailsAll" type="text/kendo-tmpl">
@(Html.Kendo().Grid<OMSWeb.Models.OrderDetailAllViewModel>()
.Name("grid2_#=OpportunityId#") //opprtunityId == row to detail off of
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Columns(columns =>
{
//columns
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetDetailsAll", "Order", new { opportunityId = "#=OpportunityId#" })) //get selected rows details
.Model(model =>
{
model.Id (z => z.OrderDetailId);
})
)
.ToClientTemplate())
</script>查看文档here
https://stackoverflow.com/questions/24185897
复制相似问题