New to Telerik UI for WinForms? Download free 30-day trial

Text and Value for RadTreeNode

RadTreeNode offers Text and Value properties which can store different information when RadTreeView is used in unbound and bound mode.

Specifying Text and Value in unbound mode

It is possible to set directly the values to the Text and Value properties. Then the TreeViewElement.EditMode property indicates whether the Text or the Value to be updated during the edit operation.

By default, when RadTreeView is in unbound mode, modifying the Text or the Value of a node will automatically update the other one. This behavior can be controlled via the EditMode property of the TreeViewElement.

The property has the following values:

  • Value: When the user performs edit, the Value will be edited.

  • Text: When the user performs edit, the Text will be edited.

  • TextAndValue: When the user performs edit, both the Text and the Value will be changed.

RadTreeNode node = new RadTreeNode();
node.Text = "Text";
node.Value = "Value";

this.radTreeView1.AllowEdit = true;
this.radTreeView1.TreeViewElement.EditMode = TreeNodeEditMode.Value;

Dim node As RadTreeNode = New RadTreeNode()
node.Text = "Text"
node.Value = "Value"
Me.RadTreeView1.AllowEdit = True
Me.RadTreeView1.TreeViewElement.EditMode = TreeNodeEditMode.Value

Specifying Text and Value in bound mode

When RadTreeView is used in bound mode, along with the DataSource property, two other properties are specified:

  • DisplayMember - controls the Text that will be displayed in the nodes.
  • ValueMember - controls the Value that will be stored in the nodes.

No matter bound or unbound mode is used, RadTreeNode offers Tag property. It is useful for storing any information.

See Also

In this article