System.Web.UI.WebControls Namespace TreeNode Class
.NET Framework version 2.0
Returns the path from the root node to the current TreeNode.
Script |
[ string strVar = ] TreeNode.ValuePath |
This property can only be used programmatically; it cannot be set when declaring the control.
strVar |
A delimiter-separated list of node values that form a path from the root node to the current TreeNode. |
The property is read/write with no default value.
Use the ValuePath property to determine the path to the Value associated with the current TreeNode.
The ValuePath property contains a delimiter-separated list of node values that form a path from the root node to the current node. The value path is used to indicate the position of a node in a TreeView control.
The delimiter character used to separate the node values can be specified using the PathSeparator property.
The ValuePath is commonly used when parsing the list for the individual values, or to pass as an argument to the FindNode method of the TreeView class.
Depending on the value displayed in the TreeView control, the delimiter character might need to be changed to prevent any conflicts. For example, if you set the delimiter character to a comma, the displayed value should not contain any commas; otherwise, you cannot accurately parse the ValuePath property.
NOTE: The values of the Value property of each node from the root node to the current node are used to generate the value path. Nodes at the same level must each have a unique value for the Value property; the TreeView control cannot distinguish between different nodes at the same level that have the same value.
The following example shows how the ValuePath property can be used to determine the list of node values that form a path from the root node to the current TreeNode.
TreeNode selectedNode = myTreeView.SelectedNode;
message.Text = "Selected TreeNode ValuePath: " + selectedNode.ValuePath;
Dim selectedNode As TreeNode = myTreeView.SelectedNode
message.Text = "Selected TreeNode ValuePath: " + selectedNode.ValuePath |
|
C# |
VB |
Show me
TreeNode Members Value