Hi,
I'm trying to add to a Grid a column that doesn't exist in the model. That column only have an icon with some functionality. The problem is the icons doesn't appear when binding data from a property in the ViewBag:
and appear when I'm populating the grid using an ajax call:
Thanks in advance.
I'm trying to add to a Grid a column that doesn't exist in the model. That column only have an icon with some functionality. The problem is the icons doesn't appear when binding data from a property in the ViewBag:
@(Html.Kendo().Grid<
Models.Location
>()
.Name("availableStops")
.BindTo((IEnumerable<
Models.Location
>)ViewBag.AvailableLocations)
.Columns(columns =>
{
columns.Bound(p => p.Id).Title("ID");
columns.Bound(p => p.StopLocation).Title("Description");
columns.Template(@<
text
></
text
>).ClientTemplate("<
span
class
=
'k-icon k-add'
title
=
'Add'
style
=
'cursor:pointer;'
onclick
=
'addStop(this)'
></
span
>").Title("Add");
})
.DataSource(dataSource => dataSource.Server().Model(model => model.Id(p => p.IRN)))
)
and appear when I'm populating the grid using an ajax call:
@(Html.Kendo().Grid<
SpyMobileLibraryRoute.Models.UISpyFmtLOC
>()
.Name("availableStops")
.Columns(columns =>
{
columns.Bound(p => p.Id).Title("ID");
columns.Bound(p => p.StopLocation).Title("Description");
columns.Template(@<
text
></
text
>).ClientTemplate("<
span
class
=
'k-icon k-add'
title
=
'Add'
style
=
'cursor:pointer;'
onclick
=
'addStop(this)'
></
span
>").Title("Add");
})
.DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("GetLocations", "Location")))
)
Thanks in advance.