Assembly: System.Web (in system.web.dll)
The HierarchicalDataBoundControl class is the base class used for ASP.NET controls that retrieve data from an ASP.NET hierarchical data source control and bind user-interface elements of the control to that data for display. The TreeView and Menu classes derive from HierarchicalDataBoundControl.
Page developers do not use the HierarchicalDataBoundControl class directly; instead, they use controls that derive from this class.
Controls developers extend this class to create data-bound controls that work with classes that implement the IHierarchicalDataSource interface and classes that derive from the HierarchicalDataSourceControl and HierarchicalDataSourceView classes. When deriving a class from the HierarchicalDataBoundControl class, override the PerformDataBinding method to bind the user-interface elements of your control to data retrieved by the GetData method. In most cases, the PerformDataBinding method is the only method you will override in your derived class.
For ASP.NET 2.0 data-bound controls, the PerformSelect method is the equivalent of the DataBind method, and is called to bind data at run time. The PerformSelect method calls the GetData and PerformDataBinding methods.
The following code example demonstrates how to derive a class from the HierarchicalDataBoundControl class to create a custom data-bound control. The GeneologyTree control renders a pre HTML section with a text tree for the data retrieved from an associated data source control.
The following code example demonstrates how to use the GeneologyTree control, defined in the previous example, and bind it to an XmlDataSource control.
The geneology.xml file accessed in the code example contains the following data.
<family> <member title="great-grandfather"> <member title="grandfather" > <member title="child" /> <member title="father" > <member title="son" /> </member> </member> </member> </family>