11.1. Using a Treeview on a Web Page

If you've used a computer, you know what a treeview is. It's a compact way of presenting hierarchical information. A treeview is one of the most popular navigation components because it doesn't overwhelm you. You can expand each leaf (also called a node) as required to discover more information and hide irrelevant parts.

NOTE

Figure 11-1 shows that an ASP.NET TreeView looks more like an upside-down tree or a big root. In fact, it starts with a Root node and spreads out and down like a root. Whatever it is, this section gets to the root of using a treeview as a navigation device on a Web page.

Figure 11-1. Although traditionally called a treeview, the control looks more like a root.

11.1.1. Creating TreeView nodes in the designer

Visual Web Developer provides a graphical interface for building and nudging nodes on a treeview. Follow these instructions to configure a treeview on a Web page or master page:

  1. From the Navigation section in the Toolbox, drag and drop a TreeView control onto an ASP.NET page.

  2. Using the Smart Tag, open the Tasks menu and choose AutoFormat.

    The AutoFormat window appears.

  3. Select a format (for example, News) and click OK.

  4. From the Tasks menu, choose Edit Nodes.

    The TreeView Node Editor appears.

  5. In the Nodes area, click the Add Root Node button.

    The Add Root Node button is on the far left in Figure 11-2.

  6. In the Properties area, ...

Get ASP.NET 3.5 For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.