I needed to implement a Hiearchical Grid with the Kendo UI Grids recently and when I looked at this demo (http://demos.telerik.com/aspnet-mvc/grid/hierarchy), I could not understand how to get the code sample to work for my particular scenario since the code sample seemed rather cryptic!
Well, as it turns out, the key element to understand in the Hierarchical Grid sample are these 2 pieces of the code:
.Name("grid_#=EmployeeID#") // template expression, to be evaluated in the master context
.Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" }))
The EmployeeID is the ACTUAL value that must be passed to the LINQ Query in order to filter the expression based on the parent record Id. If this value is ANYTHING else in the Razor View than what is being used in the LINQ Query expression, the Hierarchical Grid will not work!!
Hopefully that clarifies things a bit regarding this somewhat confusing code sample!
Well, as it turns out, the key element to understand in the Hierarchical Grid sample are these 2 pieces of the code:
.Name("grid_#=EmployeeID#") // template expression, to be evaluated in the master context
So where is this EmployeeID value ACTUALLY used??
Well, in this case, it is being used in the MVC Controller in this snippet of code:
The EmployeeID is the ACTUAL value that must be passed to the LINQ Query in order to filter the expression based on the parent record Id. If this value is ANYTHING else in the Razor View than what is being used in the LINQ Query expression, the Hierarchical Grid will not work!!
Hopefully that clarifies things a bit regarding this somewhat confusing code sample!
No comments:
Post a Comment