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
it doesnt work. (In radgridview such assignment ("tbContact.Name") works properly.)
As a solution in NodeCollectionChange
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.
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.