mike mcintyre's

.N e t J o u r n a l

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

AprMay 2008Jun
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Archives

Topics

Source Code

Source Code: Build an ASP.NET 2.0 Web Site Navigation System Pt2

Build an ASP.NET 2.0 Web Site Navigation System Part 2

This is part two of a three part article that demonstrates how to build an ASP.NET navigation system. In part one, web pages were added to a web site and then referenced in a ASP.NET 2.0 SiteMap file. In part two an ASP.NET 2.0 Menu control will be tied to the SiteMap file created in part one. In part three an ASP.NET SiteMapPath (bread crumbs menu) will be tied to the SiteMap created in part one and the Menu added in part two.

Read part one -> Part 1

Add an ASP.NET 2.0 Menu to the Web Site

Open the web site created in part one.

Open the SiteMaster page in design view.

The left side menu place holder will now be replaced with an ASP.NET Menu control.

Clear the words 'Left Side Menu (will be added in part two)' from the page.

From the Navigation menu of the Visual Studio Toolbox, drag a menu control to the left column of the web page.

Click the smart task tab on the menu control to open the 'Menu Tasks' dialog.

Use the 'Choose Data Source:' ComboBox to select 'SiteMapDataSource1'.

SiteMapDataSource1 is the data source that was created in part one of the article.

Run the web site and try the menu.   You should be able to navigate to the pages tied to the site map created in part one of the article.

About the ASP.NET Menu Class

The Menu control displays a menu in a Web Forms page. It is often used in combination with a SiteMapDataSource control to provide site navigation as shown in this part of the article.

Menu Control Features

Menu items can be bound to hierarchal data sources.

Site navigation when used in conjunction with the ASP.NET 2.0 SiteMapDataSource control

Programmatic access to the Menu class' object model to dynamically create menus, populate menu items, set properties, and so on.

Customizable appearance through themes, user-defined images, styles, and user-defined templates.

When the user clicks a menu item, the Menu control can either navigate to a linked web page or simply post back to the server. When used with the SiteMapDataSource the menu navigates to the a linked web page.

Next time:

In part three of this article, an ASP.NET SiteMapPath (bread crumbs menu) will be tied to the web site.

For more information:

SiteMap Class

Menu Class

SiteMapPath Class

 

mike mcintyre http://www.getdotnetcode.com

posted on Monday, February 05, 2007 6:48 AM