Hi,
I have a problem to get the inner items of hierarchical grid.
This is the main grid:
@(Html.Kendo().Grid(Model.List1)
.Name("List1")
.Columns(columns =>
{
columns.Bound(p => p.ColA).Title("ColA").Width(135);
columns.Bound(p => p.ColB).Title("ColB").Width(110).Template(@<text>
<a href='\\#' class='link' style="color:red;" onclick='UpdateItem(@item.ColC) '>@item.ColC</a>
</text>);
})
.Pageable()
.Sortable()
.Groupable()
.DataSource(dataSource => dataSource.Server().PageSize(5))
.HtmlAttributes(new { style = "height:500px;" })
.DetailTemplate(
@<text>
@(Html.Kendo().Grid(item.InnerList)
.Name("Inner_" + item.ListID)
.Columns(columns =>
{
columns.Bound(o => o.ColD1).Title("ColD1").Width(110).HtmlAttributes(new { @class = "btn-link", @style = "cursor: pointer;" }).HtmlAttributes(new { @onclick = "UpdateItem('"+@item.ColD1+")" })
columns.Bound(o => o.ColD2).Title("ColD2").Width(110);
})
.DataSource(dataSource => dataSource.Server())
.Pageable()
.Sortable()
)
</text>
)
______________________________________________
1. In the detail template I tried add a link to column ColD1 as in column ColC with .Template but it didn't work.
So I used HtmlAttributes instead to simulate a link :
I added: @class = "btn-link", @style = "cursor: pointer;" and it worked.
Why can't I use the .Template in the inner grid?
2. When I click on the link I want to run a javascript function. I tried sending the inner item as parameter to the function (as I did successfully in the main grid with @item) but it didn't work.
I tried to send it in many ways:
1. @item.ColD1
2. o.ColD1
3.\\#= ColD1\\#
But none of the ways worked....
I'll be glad to receive your help,
Elad.