Reputation: 31
This is typical example from telerik, I try create template for nested grid but without success
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.EmployeeViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(e => e.FirstName).Width(110);
})
.ClientDetailTemplateId("template")
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("HierarchyBinding_Employees", "Grid"))
)
.Events(events => events.DataBound("dataBound"))
)
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()
.Name("grid_#=EmployeeID#")
.Columns(columns =>
{
columns.Bound(o => o.OrderID).Width(110);
columns.Bound(o => o.ShipCountry).Width(110);
columns.Bound(o => o.ShipName).Width(200);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" }))
)
.ToClientTemplate()
)
</script>
How create client template for nested grid? Because columns.Bound(o => o.OrderID).ClientTemplate("#=OrderID# - #=ShipName#")
not work.
Upvotes: 0
Views: 2765
Reputation: 11
Somewhat late, but for anyone who search for this answer too:
Escape the template expression, to be evaluated in the child/detail context
Ex:
columns.Bound(o => o.OrderID).ClientTemplate("\\#=OrderID\\# - \\#=ShipName\\#")
Hierarchy Demo MVC with client template on child
Upvotes: 0
Reputation: 1
Try to use without hashtag in columns.Bound(o => o.OrderID).ClientTemplate("OrderID - ShipName")
Conditional client template in Razor hierarchical grid
Upvotes: 0