Assigning DisplayMember to Entity Reference

3 posts, 0 answers
  1. Onur Tezic
    Onur Tezic avatar
    3 posts
    Member since:
    Sep 2009

    Posted 01 Dec 2009 Link to this post


    Here is the problem :

    I have a binding source (bsCustomers) filled with neccessary data from the database with entity framework.

    When i checked the bsCustomers i can see the values are not NULL.
    My treeview control`s (rtvCustomers) datasource is bsCustomers and I want to assign rtvCustomers.DisplayMember to Name field which is in tbContacts. 

    bsCustomer  has --> tbContact.
    tbContact has --> Code, Name.

    So when i say

    this.tvCustomers.RootRelationDisplayName = "Customers";  
    this.tvCustomers.DisplayMember = "tbContact.Name";  
    thisthis.tvCustomers.DataSource = this.bsCustomers; 

    it doesnt work. (In radgridview such assignment ("tbContact.Name") works properly.)

    As a solution in NodeCollectionChange

    void Nodes_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)  
                    if (((RadTreeNode)e.NewItems[0]).Level == 0)  
                    ((RadTreeNode)e.NewItems[0]).Text = ((Customer)this.bsCustomers[e.NewStartingIndex]).tbContact.Name;  

    and it worked. I filled the treeview with customer Names. But i guess there must be another solution.

    So is there any other solution to get treeview filled with Names?


  2. Nikolay
    Nikolay avatar
    1802 posts

    Posted 07 Dec 2009 Link to this post

    Hello Onur Tezic,

    Currently, RadTreeView does not support binding to subproperties. We will implement this feature in one of our next versions. I have logged this as a feature request in our issue tracking system.

    Your Telerik points have been updated for the feedback.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Stefan
    Stefan avatar
    2891 posts

    Posted 22 Mar 2011 Link to this post

    Hi Onur Tezic,

    Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post.
    Kind regards,
    the Telerik team
Back to Top