I am using Mvc telerik Grid and using Ajax with paging. (.RowAction) I set the value of its id through HTML Attributes. My problem is when i press [Page 2] Link on the buttom of the Grid, it goes back to controller and brings back new new for that page but somehow i lost HTML ID attribute in this process. If i see the source code of my page the <tr> does not have any id.
This works fine if i dont use Ajax.
Please Help me. I am pasting my View's Source code below.
@{Html.Telerik().Grid(Model)
.Name(
"Grid")
.Pageable(paging =>paging.PageSize(10))
.Columns(columns =>
{
columns.Bound(o => o.Name);
columns.Bound(o => o.CarrierId);
})
.Pageable(paging => paging.PageSize(10).Style(
GridPagerStyles.NextPreviousAndNumeric).Position(GridPagerPosition.Bottom))
.DataBinding(dataBinding => dataBinding.Ajax().Select(
"_Index", "Home"))
.CellAction(cell =>
{
if (cell.Column.Member == "Name"){
cell.HtmlAttributes[
"id"] = cell.DataItem.CarrierId;
}
})
.RowAction(row=>
{
row.HtmlAttributes[
"id"] = row.DataItem.CarrierId;
}
)
.Render();
}