In a simple table, I know I'd be able to just call Count in a cell, and there weren't any problems. However, trying to do it in a Grid has been challenging:
This is how my MVC Grid looks like:
@(Html.Kendo().Grid<
ContentExternalLink
>()
.Name("issue-grid")
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(x => x.LinkId))
.Read(read => read.Action("ContentExternalLink_Read", "ContentManagement"))
.Create(create => create.Action("ContentExternalLink_Create", "ContentManagement"))
.Update(update => update.Action("ContentExternalLink_Update", "ContentManagement"))
.Destroy(delete => delete.Action("ContentExternalLink_Destroy", "ContentManagement"))
.ServerOperation(true)
.PageSize(10))
.Columns(columns =>
{
columns.Bound(x => x.LinkId).Hidden();
columns.Bound(x => x.LinkTitle).Title("Title").Template(@<
text
>
<
a
href
=
"@item.LinkUrl"
taget
=
"_blank"
>@item.LinkTitle</
a
>
</
text
>);
columns.Bound(x => x.LinkTypeId).Title("Type");
columns.Bound(x => x.LinkCreatedDate).Title("Created");
columns.Bound(x => x.ContentTagAssignments.Count).Title("Tags");
columns.Bound(x => x.LinkSource).Hidden();
columns.Bound(x => x.LinkPhoneNumber).Hidden();
columns.Bound(x => x.LinkDate).Hidden();
columns.Bound(x => x.LinkCreatedDate).Hidden();
columns.Bound(x => x.LinkModifiedDate).Hidden();
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Scrollable(scr => scr.Height("auto"))
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
)
When I run that, I get the Javascript error: Cannot read property 'Count' of undefined.
Any ideas how to get what I want to achieve?
Thank you!
AJ