All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Obtain Nodes and Their Row Handles

  • 2 minutes to read

The TreeViewControl includes multiple methods that allow you to obtain nodes and their row handles. This topic lists and describes these methods.

A row handle is an integer value that identifies a node regardless of whether it is displayed in the TreeViewControl. A visible index is an integer value that identifies only a visible node. If a node is hidden within a collapsed node, its visible index is always -1.

The following images illustrate the difference between row handles and visible indices.

  • All nodes are expanded:

  • One node is collapsed:

Obtain Nodes

Method Description
GetNodeByContent(Object) Returns a node with the specified content.
GetNodeByValue(Object) Returns a node with the specified display value.
GetNodeByRowHandle(Int32) Returns a node with the specified handle.
GetNodeByVisibleIndex(Int32) Returns a node with the specified visible index.
CurrentNode Gets or sets the focused node.
SelectedItems Returns the collection of selected nodes.

Obtain Row Handles

API Description
TreeListNodeBase.RowHandle Returns a node's row handle.
GetSelectedRowHandles() Returns row handles of selected nodes.
GetRowHandleByVisibleIndex(Int32) Returns a node's row handle by its visible index.
GetRowVisibleIndexByHandle(Int32) Returns a node's position in the TreeViewControl by its row handle.

Example

The following code sample gets a node with the specified value, obtains the node's row handle, and expands the specified node.

void ExpandSpecifiedNode() {
    var node = treeview.GetNodeByValue("Marketing");
    var rowHandle = node.RowHandle;
    treeview.ExpandNode(rowHandle);
}