Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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);
}