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

Assigning DisplayMember to Entity Reference

2 Answers 38 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Onur Tezic
Top achievements
Rank 2
Onur Tezic asked on 01 Dec 2009, 01:29 PM
Hi,

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(e.Action==Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)  
            {  
                if (((RadTreeNode)e.NewItems[0]).Level == 0)  
                    return;  
                ((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?

Thanks.


2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Dec 2009, 12:25 PM
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.


Regards,
Nikolay
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.
0
Stefan
Telerik team
answered on 22 Mar 2011, 04:51 PM
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,
Stefan
the Telerik team
Tags
Treeview
Asked by
Onur Tezic
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
Stefan
Telerik team
Share this question
or