I have a hierarchy grid controlled by a TabStrip. I need to pass additional parameters, such as the TabStrip value, to the child Grid read action method.
For example
.Read(read => read.Action("HierarchyBinding_MetricGroups", "DataEntry", new { CategoryKey = "#=CategoryKey#", TabStipKey = key }))
I know you can pass parameters using a javascript function with
.Data("javascriptFunction")But I am not sure how to pass the template expression to that function.
Below is the code I am using
<div id="dataEntryContainer"><br> @(Html.Kendo().TabStrip()<br> .Name("sitetabs")<br> .Items(tabstrip =><br> {<br> bool selected = true;<br> foreach (var site in Model.Sites)<br> {<br> tabstrip.Add().Text(site.Name)<br> .Selected(selected)<br> .Content(@<text><br> @(Html.Kendo().Grid(Model.Categorys)<br> .Name("grid_" + site.DisplayName)<br> .Columns(columns => { columns.Bound(c => c.Name).Title(""); })<br> .Events(events => events.DataBound("dataBound"))<br> .ClientDetailTemplateId("metricgroup-template")<br> .DataSource(dataSource => dataSource<br> .Ajax()<br> .Read(read => read.Action("HierarchyBinding_Categorys", "DataEntry"))<br> )<br> )<br> </text><br> );<br> selected = false;<br> }<br> })<br> .Events(events => events.Select("onSelect"))<br> )<br></div><br><br><script id="metricgroup-template" type="text/kendo-tmpl"><br> @(Html.Kendo().Grid<BalancedScorecardManagement.Models.vMetricGroup>()<br> .Name("grid_#=CategoryKey#") // template expression, to be evaluated in the master context<br> .Columns(columns =><br> {<br> columns.Bound(m => m.MetricGroupLabel).Title("");<br> })<br> .DataSource(dataSource => dataSource<br> .Ajax()<br> .Read(read => read.Action("HierarchyBinding_MetricGroups", "DataEntry", new { CategoryKey = "#=CategoryKey#" }))<br> )<br> .Events(events => events.DataBound("dataBound"))<br> .ClientDetailTemplateId("metric-template")<br> .ToClientTemplate()<br> )<br></script>