asp.net.ph

TreeView.Nodes Property

System.Web.UI.WebControls Namespace   TreeView Class


.NET Framework version 2.0

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

Syntax


Script [ TreeNodeCollection variable = ] TreeView.Nodes

Property Value


variable Returns a TreeNodeCollection that contains the root nodes in a TreeView.

The property is read/write with no default value.

Remarks

Use the Nodes collection to programmatically obtain information about each root node in a TreeView control. This collection is typically used to iterate through all the root nodes, or to access a specific root node in the tree.

NOTE: 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 programmatically add, insert, or remove TreeNode objects in 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 or parent node, use the ChildNodes property of the node ( or the subsequent parent-level node ) to navigate down the node hierarchy.

Example

The following example shows how to programmatically add TreeNode objects to the Nodes collection of a TreeView control.

TreeNode newNode = new TreeNode ( nodeText, nodeValue );
newNode.NavigateUrl = webPageUrl;
menuObject.Nodes.Add ( newNode );

 Show me 

TreeView Members   TreeNode Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph