The TreeView control (Ipower web hosting) shows the navigational structure in
The TreeView control shows the navigational structure in a collapsible tree, as in the example at right in Figure 8-2. The user can click + and signs to (respectively) expand and collapse categories. I m sure you ve seen a gazillion similar collapsible trees; in VWD, both the Toolbox and Solution Explorer are collapsible trees. The TreeView control is best for handling larger navigational tasks. Both the Menu and TreeView commands can be used with either static data or dynamic data. When using a control with static data, the navigational structure of the site is defined as part of the control. The method is easier in that you can define the whole menu structure just by filling in the blanks in dialog boxes. With dynamic data, you store data about the site s structure in a file, called a site map, that s external to the control. The advantage to this approach is that the site s navigational structure is stored in one place. So if you need to change the navigational structure of the site, you just have to change the external file, not every control on every page. In the sections that follow, I ll look at using both controls with static data and with dynamic, external data. Using the TreeView and Menu Controls The TreeView and Menu server controls are both in the Navigation category of the Toolbox. They re so similar that reading one set of instructions is sufficient for you to use either. In this section, I describe how to use the controls with static data (without a site map that s defined in an external file). This is the easiest way to create a map, especially if it s a small map that s not likely to change often. (That s especially true if, like a lot of us, you know nothing about XML and can t type worth beans.) The only real drawback to this method is that it s tedious. And if you put the control on a specific Web page, you d have to re-create the control on (or copy and paste the control to) other pages. (Unless you put the control in a Master Page, in which case it will appear on all pages that use the Master Page which may not be what you re looking for.) If you don t want to put the navigation control on a Master Page, you could put it in a Web User Control and use it as needed on pages throughout your site. I ll talk about Web User Controls later in this chapter. So the first step is to open the page on which you want to place the Menu or TreeView control. Make sure you re in Design view. Then follow these steps: Chapter 8: Easy Site Navigation 155
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision make web site services