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

Binding Object to Rad Menu

1 Answer 52 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Pasquale
Top achievements
Rank 1
Pasquale asked on 07 Mar 2012, 03:01 PM
Hello Everybody,

I would like to know if it's possible to bind this type of object to the rad menu:

class Parent {
  string name
  int id
  List<child>
}

class child {
  string name
  int id
}

I tried many times without any luck.
Thanks.

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 08 Mar 2012, 09:29 PM
Hello Pasquale,

The RadMenu cannot bind to an object like that because it will not iterate through your List<child> object. The only structure that it would be able to bind to, with regards to a class, would have to look something like this:

class Item
{
    string name;
    int id;
    int? parentId;
}

Here the parent and child objects are the same class, the only difference being that the child has a value set in it's parentId field, where the parent would have this set as null (this is how it determines what are root elements).

I hope that explains how the RadMenu binding works.
Tags
Menu
Asked by
Pasquale
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Share this question
or