Hi all,
I am trying to make an HtmlHelper to create sub grids by passing an ISubGridBuilder which will contain the construction detail of my sub grid.
Example:
public
interface
ISubGridBuilder
{
string
ActionName {
get
; }
string
ControlerName {
get
; }
void
BuildColumns(GridColumnFactory<dynamic> gcf);
}
public
static
MvcHtmlString SubGridClient(
this
HtmlHelper html, ISubGridBuilder builder)
{
return
html.Kendo().Grid<dynamic>()
.Name(
"detailGrid"
)
.Navigatable(n => n.Enabled(
true
))
.Selectable(s => s
.Mode(GridSelectionMode.Single)
.Type(GridSelectionType.Row))
.Columns(gcf =>
{
gcf.Bound(
"ParentId"
).Hidden(
true
);
gcf.Bound(
"Id"
).Hidden(
true
);
builder.BuildColumns(gcf);
})
.DataSource(d => d
.Ajax()
.Model(m =>
{
m.Id(
"Id"
);
m.Field(
"ParentId"
,
typeof
(
int
));
})
.Read(r => r.Action(builder.ActionName, builder.ControlerName,
new
{Id =
"#=ParentId#"
}))
.PageSize(3)
)
.Pageable(p => p
.AlwaysVisible(
false
)
.PageSizes(
new
[] { 3 })
)
.Events(e => e.Change(
"function(e) { onChange(e)}"
))
.ToClientTemplate();
}
The problem is that at runtime I get a reference error:
VM17183:3 Uncaught ReferenceError: ParentId is not defined
at Object.eval [as tmpl0] (eval at compile (kendo.all.js:234), <anonymous>:3:12352)
at Object.eval (eval at compile (kendo.all.js:234), <anonymous>:3:185)
at d (jquery.min.js:2)
at HTMLAnchorElement.<anonymous> (kendo.all.js:64799)
at HTMLTableElement.dispatch (jquery.min.js:3)
at HTMLTableElement.r.handle (jquery.min.js:3)
How can I add the ParentId parameter on the routeValues for the controller call.
Thank you!