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

BusinessObject Databinding

1 Answer 28 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Nancy
Top achievements
Rank 1
Nancy asked on 06 May 2011, 01:53 PM

I have an application that was working fine and then upgraded to the latest version without reading the release notes. I know....dumb...but wanted to keep current.

The problem is with databinding.
I have the following business object that has child colletions for ProductCategories and Locations:

public class Customer
{
    private string name;
    private List<ProductCategory> categories;
    private List<Location> locations;
  
    ... with their associated public properties;
}
the ProductCategories class also has a child collection of products like so..
public class ProductCategory
{
    private string categoryName;
    private List<Product> products;
  
 ....
}
public class Product
{
    private string productName;
    ......
}

I would like that tree to display the following:
Customer Name
     Product Categories
          Product Category 1
               Product Name 1
               Product Name 2
          Product Category 2
               Product Name 1
               Product Name 2
 Locations
      Location Name 1
      Location Name 2

When I retrieve the information about the customer the child collections get loaded up in a List<Customer> custList 
  
How do I set that up?
Do I use the RelationBindings colletion? If so, how?

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 10 May 2011, 04:53 PM
Hi Nancy,

Thank you for writing.

You can achieve the desired behavior by making use of the Load On Demand binding functionality of RadTreeView. Please refer to the attached sample project, which demonstrates the desired functionality. In the example I have switched off the full LazyMode of the control, in order to allow it to load just one level of hierarchy, which handles the expanders of the nodes correctly.

I hope this helps. Should you have any other questions, do not hesitate to contact us.

All the best,
Stefan
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
Treeview
Asked by
Nancy
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or