TreeView Navigation in ASP.Net 2.0 - TreeView Declarative Binding
(Page 2 of 5 )
If your web site is relatively small and stable then it’s probably safe to declaratively populate the TreeView. Use the declarative method if the menu is not likely to ever change. The navigation nodes will be placed directly inside the TreeView declaration. Figure 2 shows the minimum code required to create a TreeView. We’ll define the nodes where the figure says “[menu items are declared here]”:

The TreeView declaration itself is pretty simple: the ID and runat are required tags for any web control.
Node Types
The TreeView menu has three node types: Root, Parent and Leaf.
Root nodes have null parent nodes. Shelters and Humane Societiesare root nodes.
Parent nodes have a parent and a child. Local is a parent node.
Leaf nodes have a parent but not a child: Municipal, Private, Mixed, Private and Public are leaf nodes.
To illustrate the differences, let’s color the Root blue, the Parent black and the Leaf red.

Figure 4 shows the Root, Parent and Leaf colored variations.
Figure 4 Root, Parent and Leaf Illustration

Next: Declaring the TreeView Nodes >>
More ASP.NET Articles
More By Caroline Bogart