BusinessObject Databinding

2 posts, 0 answers
  1. Nancy
    Nancy avatar
    4 posts
    Member since:
    Oct 2008

    Posted 06 May 2011 Link to this post

    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

     

  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 10 May 2011 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top