Skip to main content
A newer version of this page is available. .
Tab

TreeViewNode.Nodes Property

Gets the collection of child nodes within the particular node and provides indexed access to them.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

public TreeViewNodeCollection Nodes { get; }

Property Value

Type Description
TreeViewNodeCollection

A TreeViewNodeCollection object representing the collection of the child nodes.

Remarks

Use the Nodes property to access the collection of child nodes of the current node. This collection contains only the nodes at the next level. To access nodes further down the ASPxTreeView, use the Nodes property of a child node. If the Nodes property is the null reference (Nothing in Visual Basic), the current node does not have any child nodes. A particular node can be accessed using index notation.

Note that the nodes of an ASPxTreeView’s root node can be accessed via the ASPxTreeView.Nodes property of the ASPxTreeView control.

Example

The code below demonstrates how you can implement recursive tree traversal, to execute a specific action for each node.

protected void PerformActionOnNodesRecursive(TreeViewNodeCollection nodes, Action<TreeViewNode> action) {
        foreach (TreeViewNode node in nodes) {
            action(node);
            if (node.Nodes.Count > 0)
                PerformActionOnNodesRecursive(node.Nodes, action);
        }
}
See Also