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

DataBinding : Change the node name in the treeView

3 Answers 84 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
anouar b
Top achievements
Rank 1
anouar b asked on 05 Aug 2009, 10:33 AM
Hello,

I am generating a treeView from 3 SQL Server tables.
I added the binding sources, table adapter .... 
I write this code:

 

this.villeTableAdapter.Fill(this.logisticsDataSet.Ville);
/
/ TODO: This line of code loads data into the 'logisticsDataSet.Region_2' table. You can move, or remove it, as needed. 

 

 

this.region_2TableAdapter.Fill(this.logisticsDataSet.Region_2);
// TODO: This line of code loads data into the 'logisticsDataSet.Region_1' table. You can move, or remove it, as needed. 
this.region_1TableAdapter.Fill(this.logisticsDataSet.Region_1);

// TODO: This line of code loads data into the 'logisticsDataSet.Pays' table. You can move, or remove it, as needed.

 

this.paysTableAdapter.Fill(this.logisticsDataSet.Pays);
this.radTreeView1.RelationBindings.Add(new RelationBinding("FK_Reg_1_Cont", this.Region1bindingSource)); this.radTreeView1.RelationBindings.Add(new RelationBinding("FK_Reg_2_Reg_1", this.Region2bindingSource));this.radTreeView1.RelationBindings.Add(new RelationBinding("FK_Emp_Reg_2", this.Region2bindingSource));

this.radTreeView1.RootRelationDisplayName = "Cont";
this.radTreeView1.DataSource = this.paysBindingSource;

Now my treeView is correctly populated.

My problem is how the change the text displayed in the treeNode because i want that the treeView another column name (and in the future i want to customize the text displayed in the treeNode) ?
Thanks in advance.

 

 

 

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 05 Aug 2009, 11:45 AM
Hi anouar b,

Thank you for writing. You can set the Text property of RadTreeNode to whatever text you need. Please write again if I have misunderstood your question or if this is not the solution you are looking for.

All the best,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
anouar b
Top achievements
Rank 1
answered on 05 Aug 2009, 11:55 AM
But i want that the text will be binded to the corresponding tableAdapter.

I want to change the text of the Items automatically displayed.

For exemple if i have a table named 'pays' in my database which contains the following columns :
Pays_Name
Pays_Code 
Pays_ID

i want that all the treeNodes of 'Pays' take as text not only "Pays_Name" but "Pays_Name" cantatened with "Pays_code"
0
Victor
Telerik team
answered on 07 Aug 2009, 10:46 AM
Hi anouar b,

This is a very custom scenario and RadTreeView does not account for it. You will have to come up with your own  solution in order to bind the tree view in such a specific manner.

Greetings,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Treeview
Asked by
anouar b
Top achievements
Rank 1
Answers by
Victor
Telerik team
anouar b
Top achievements
Rank 1
Share this question
or