TreeView.Nodes Property

Gets a collection of TreeNode objects that represents the root nodes in the TreeView control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
property TreeNodeCollection^ Nodes {
	TreeNodeCollection^ get ();
}
/** @property */
public TreeNodeCollection get_Nodes ()

public function get Nodes () : TreeNodeCollection

Not applicable.

Property Value

A TreeNodeCollection that contains the root nodes in the TreeView.

Use the Nodes property to get a TreeNodeCollection object that contains all the root nodes in the tree. This collection is commonly used to quickly iterate through all the root nodes, or to access a specific root node in the tree.

NoteNote:

A typical tree structure has only one root node; however, you can add multiple root nodes to the TreeView control.

The Nodes property can also be used to manage the root nodes in the tree programmatically. You can add, insert, remove, and retrieve TreeNode objects from the collection. Any updates to the collection are automatically reflected in the TreeView control after the next round trip to the server.

To access the child nodes of a root node, use the ChildNodes property of the node. Use the ChildNodes property of each subsequent parent-level node to navigate down the node levels.

The following code example demonstrates how to use the Nodes property to traverse the tree.

No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: