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#"
, TabStipValue = value}))
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"
>
@(Html.Kendo().TabStrip()
.Name("sitetabs")
.Items(tabstrip =>
{
bool selected = true;
foreach (var site in Model.Sites)
{
tabstrip.Add().Text(site.Name)
.Selected(selected)
.Content(@<
text
>
@(Html.Kendo().Grid(Model.Categorys)
.Name("grid_" + site.DisplayName)
.Columns(columns => { columns.Bound(c => c.Name).Title(""); })
.Events(events => events.DataBound("dataBound"))
.ClientDetailTemplateId("metricgroup-template")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_Categorys", "DataEntry"))
)
)
</
text
>
);
selected = false;
}
})
.Events(events => events.Select("onSelect"))
)
</
div
>
<
script
id
=
"metricgroup-template"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
BalancedScorecardManagement.Models.vMetricGroup
>()
.Name("grid_#=CategoryKey#") // template expression, to be evaluated in the master context
.Columns(columns =>
{
columns.Bound(m => m.MetricGroupLabel).Title("");
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HierarchyBinding_MetricGroups", "DataEntry", new { CategoryKey = "#=CategoryKey#" }))
)
.Events(events => events.DataBound("dataBound"))
.ClientDetailTemplateId("metric-template")
.ToClientTemplate()
)
</
script
>