如何在Kendo Grid中做DetailView

时间:2014-12-18 00:38:20

标签: kendo-ui kendo-grid kendo-asp.net-mvc

我在Telerik MVC中使用Grid中的DetailView在单击主网格中的行时显示另一个网格。它工作正常。在Kendo中执行此操作时,我在脚本中创建客户端模板,并在Grid定义中添加ClientDetailTemplateId以传递参数。但是,当单击主网格行中的箭头时,它无法显示第二个网格。这是代码,

<%= Html.Kendo().Grid<MaintenanceAthletesSportsInfoViewModel>()
.Name("Sports")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(a => a.ResourceSportId)) 
.ServerOperation(true)
.Create(create => create.Action("InsertAthletesSport", "Maintenance"))
.Read(read => read.Action("AthletesSportsInfoAjax", "Maintenance", new { id = ViewData["resourceId"] }))
.Update(update => update.Action("UpdateAthletesSport", "Maintenance"))
.Destroy(destroy => destroy.Action("DeleteAthletesSport", "Maintenance"))
)
.Resizable(resize => resize.Columns(true))
.Sortable()
.Filterable()
.ClientDetailTemplateId("BenchmarksTemplate")
.Columns(columns =>
{
...
})
%>

<script id="BenchmarksTemplate" type="text/x-kendo-template">
<% Html.Kendo().Grid<MaintenanceAthletesBenchmarkSportsViewModel>()
.Name("Benchmarks_#=ResourceSportId#")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(a => a.BenchmarkResourceId))
.ServerOperation(true)
.Create(create => create.Action("InsertAthletesBenchmark", "Maintenance", new { resourceSportId = "#=ResourceSportId#" }))
.Read(read => read.Action("AthletesBenchmarkSportsAjax", "Maintenance", new { resourceSportId = "#=ResourceSportId#" }))
.Update(update => update.Action("UpdateAthletesBenchmark", "Maintenance", new { resourceSportId = "#=ResourceSportId#" }))
.Destroy(destroy => destroy.Action("DeleteAthletesBenchmark", "Maintenance", new { resourceSportId = "#=ResourceSportId#" }))
)
...
.ToClientTemplate();
%>           
</script>

如果改变&#34;&lt;%&#34;到&#34;&lt;%:&#34;在&#34;脚本id =&#34; BenchmarksTemplate&#34;&#34;,然后未显示主网格。我需要帮助。感谢。

0 个答案:

没有答案