Hi,
how do i add a custom column to a child grid containing a Action Link with the ID of the current child row entity?
here is a example of the hierarchical grid:
The Question is: How can the Id of the ChildModelEntity be resolved and passed into the ActionLinkMethod? "#=Id#" returns the Id of the parent model.
Thanks in advance for answers!
how do i add a custom column to a child grid containing a Action Link with the ID of the current child row entity?
here is a example of the hierarchical grid:
@(Html.Kendo().Grid<
MyParentGridModel
>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id).Groupable(false).Width(50);
columns.Bound(p => p.Name);
columns.Bound(p => p.ShortDescription);
columns.Bound(p => p.LinkText);
})
.Sortable()
.Pageable()
.Scrollable(scr=>scr.Height(500))
.ClientDetailTemplateId("template")
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("ParentModel_Read", "ControllerName"))
)
)
<
script
id
=
"template"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
ChildGridModel
>()
.Name("Grid_#=Id#")
.Columns(columns =>
{
columns.Bound(o => o.PageNumber).Width(50);
columns.Bound(o => o.ChapterTitle).Width(150);
columns.Bound(o => o.BodyContent);
columns.Template(@<
text
>
@Html.ActionLink("edit", "ControllerAction", "ControllerName", new { id = @item.Id }, new {@class = "k-button" })
</
text
>)
.ClientTemplate(@Html.ActionLink("edit", "ControllerAction", "ControllerName", new { ID = "#=Id#" }, new { @class = "k-button" }).ToHtmlString());
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("ChildModel_Read", "ControllerName", new { parentModelId = "#=Id#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</
script
>
Thanks in advance for answers!