Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Treeview > Binding to list of objects containing 2 lists

Not answered Binding to list of objects containing 2 lists

Feed from this thread
  • Richard avatar

    Posted on Jan 12, 2012 (permalink)

    Hello all,

    Scenario:
    I am using the latest Radcontrols for Winforms (2011.3.11.1116) and I have a list of classes(categories) comprised of the following:
    Name (string)
    SubCats (List of objects(1) - each with props (Name, list of Reports))
    Reports (List of objects(1) - each with props (list of Reports)) 

    Reports is made up of Name and ID

    Is it possible to use something like:
    .Displaymember = "Name\Name\Name\Name"
    .ChildMemeber = "categories\Reports\SubCats\Reports

    or am I forced to loop through my class and populate the nodes manually?

    Any help is appreciated.

    Reply

  • Richard avatar

    Posted on Jan 12, 2012 (permalink)

    Update: 

    I finally just looped through the lists and programmatically built the node list for the tree. 

    I'm still looking forward to hearing if there is another approach to binding to this type of data source.

    Thanks in advance.

    Reply

  • Julian Benkov Julian Benkov admin's avatar

    Posted on Jan 17, 2012 (permalink)

    Hello Richard,

    You can not present the desired structure using object-relational binding mode. The issue is that the Reports object from the second level does not contain SubCats in its properties. You can present the structure with SubCats at the second level following your description of objects:

    .DisplayMember = "Name\Name\Name"
    .ChildMember = "categories\SubCats\Reports"

    The solution in your case is to loop through the lists and programmatically build the nodes.

    I hoe this helps. Let me know if you need further assistance.

    Kind regards,
    Julian Benkov
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Treeview > Binding to list of objects containing 2 lists
Related resources for "Binding to list of objects containing 2 lists"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]