O'Reilly logo

ASP.NET 2.0: A Developer's Notebook by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Display Drop-Down Menus Using the Menu Control

Note

You can now use the Menu control in ASP.NET 2.0 to menu on the client side. No more client-side script!

Besides using the TreeView control to display site information, you can also use the Menu control to automatically generate a drop-down menu on the browser using client-side script. Sometimes menus are a useful means of navigating a site. For example, Nissan Motors USA (http://www.nissanusa.com) uses menus to allow visitors of their site to choose the various vehicle models they want to view.

How do I do that?

In this lab, you will add a Menu control to the Master page created in the earlier lab Section 2.5. The user will then be able to use the Menu control to navigate your site.

  1. Using the project created in the lab Section 2.5, add a Menu control (found in the Standard tab of the Toolbox) to the Master page and apply the "Colorful" theme (via the Auto Format... link in the MenuTasks menu) to change its look (see Figure 2-41).

    Customizing the Menu control

    Figure 2-41. Customizing the Menu control

  2. In the Menu Tasks of the Menu control, select SiteMapDataSource1 as its data source (see Figure 2-42). The SiteMapDataSource1 control was added when the TreeView control was configured earlier.

    Adding a Menu control to the Master page

    Figure 2-42. Adding a Menu control to the Master page

  3. To test the Menu control, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required