asp.net.ph

TreeNode.ChildNodes Property

System.Web.UI.WebControls Namespace   TreeNode Class


.NET Framework version 2.0

Returns a collection of TreeNode objects that represents the first-level child nodes of the current node in a TreeView control.

Syntax


Script [ TreeNodeCollection variable = ] TreeNode.ChildNodes

Property Value


variable Returns a TreeNodeCollection that contains the first-level child nodes of the current node in a TreeView.

The property is read only with no default value.

Remarks

Use the ChildNodes collection to programmatically obtain information about each of the first-level child nodes of the current node in a TreeView control. This collection is typically used to iterate through all the child nodes, or to access a specific child node, of the current node.

The ChildNodes 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 TreeNode control after the next round trip to the server.

To access the child nodes further down the tree, use the ChildNodes property of the next-level child node to navigate down the node hierarchy.

Example

The following example shows how to programmatically add child node objects to the ChildNodes collection of a root or parent TreeNode control.

TreeNode newNode = new TreeNode ( nodeText, nodeValue );
newNode.NavigateUrl = webPageUrl;
parentNode.ChildNodes.Add ( newNode );
  C# VB

 Show me 

See Also

TreeNode Members 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