This is a migrated thread and some comments may be shown as answers.

Binding grid to object with null complex property

0 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elton Saulsberry
Top achievements
Rank 1
Elton Saulsberry asked on 13 Aug 2012, 04:12 PM
I have an data model for a recursive parent-child relationship like this:

    public class ActivityCategory
    {
        public int CategoryID { getset; }
        public string CategoryName { getset; }
        public int? ParentCategoryID { getset; }
        public ActivityCategory Parent { getset; }
...
    }

The parent may be null.  I'm trying to set my grid up like this:
        @(Html.Kendo().Grid(Model)
                    .Name("ActivityCategoryGrid")
                    .Columns(columns =>
                    {
                        columns.Bound(resource => resource.CategoryName).Title("Name");
                        columns.Bound(r => r.Parent != null ? r.Parent.CategoryName : "");
which fails with

Bound columns require a field or property access expression.

How should I handle this?

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Elton Saulsberry
Top achievements
Rank 1
Share this question
or