control can be used in any situation in which you need to display hierarchical data. For example, you can use this control to provide a site navigation, displaying database records from database tables in a Parent/Child relation, displaying the contents of an XML document, or displaying files and folders from the file system. It is also possible for you to programmatically access the TreeView object model to dynamically create trees, populate nodes, set properties and so on. The TreeView control consists of nodes and there are three types of nodes that you can add to a TreeView control.
- Root - A root node is a node that has no parent node. It has one or more child nodes.
- Parent - A node that has a parent node and one or more child nodes
- Leaf - A node that has no child nodes
The easiest way to use the TreeView control is to specify a static set of tree nodes . the following is an example on how to define the TreeView Nodes Declarativley :
<asp:TreeView ID="TreeView1" runat="server">
<asp:TreeNode Text="Products" Value="Products">
<asp:TreeNode Text="Computers" Value="Computers">
<asp:TreeNode Text="Brand" Value="Brand"></asp:TreeNode>
<asp:TreeNode Text="Compatable" Value="Compatable"></asp:TreeNode>
<asp:TreeNode Text="NoteBooks" Value="NoteBooks"></asp:TreeNode>
<asp:TreeNode Text="HardDisks" Value="HardDisks"></asp:TreeNode>
<asp:TreeNode Text="Monitors" Value="Monitors"></asp:TreeNode>
Also you can use the TreeView to provider a Site Navigation capabilities, in this case you need to configure the TreeView to use the SiteMapDataSource To Dynamicly display the SiteMap Nodes .
The TreeView and Menu Controls can provide a good solution for site Navigation ,specially if they combined with the Roles and Security Trimming Capabilities.
More Resources On