Hi..
I have a problem with RadTreeView, when I change the text attribute of node, the value attribute change also to the same value.
please any idea to work around this problem will be Grateful.
Thanks
1 Answer, 1 is accepted
1
Stefan
Telerik team
answered on 28 Jun 2012, 07:34 AM
Hello Osamaweb,
Thank you for writing.
When working in unbound mode the Text and the Value properties of the control are linked by default. You can control this behavior via the EditMode property of the TreeViewElement:
If you need to store another object in a node, you can use its Tag property.
If you work in bound mode the Value will hold the value of the ValueMemeber field while the Text will hold the DisplayMember field. Here is an example:
DataTable table = new DataTable();
table.Columns.Add("ID");
table.Columns.Add("Name");
for (int i = 0; i < 10; i++)
{
table.Rows.Add(i, "Name " + i);
}
radTreeView1.DataSource = table;
radTreeView1.DisplayMember = "Name";
radTreeView1.ValueMember = "ID";
In the code above the Value will hold the "ID" field (1 to 10 in this case) and the Text will hold the "Name" field - "Name 1-10".