IHierarchyData::HasChildren Property

 

Indicates whether the hierarchical data node that the IHierarchyData object represents has any child nodes.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

property bool HasChildren {
	bool get();
}

Property Value

Type: System::Boolean

true if the current node has child nodes; otherwise, false.

The HasChildren property is a convenience property that enables callers to avoid checking the return value of the GetChildren method for null. If the HasChildren property returns true, call the GetChildren method to retrieve an IHierarchicalEnumerable collection of child nodes.

The following code example demonstrates how an ASP.NET hierarchical data-bound control uses an IHierarchyData object in a recursive data-binding method. The items in an IHierarchicalEnumerable collection are enumerated, and for each an IHierarchyData object is retrieved using the GetHierarchyData method. Finally, the HasChildren property is checked to determine whether to recurse. This code example is part of a larger example provided for the HierarchicalDataBoundControl class.

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

.NET Framework
Available since 2.0
Return to top
Show: