| This is part three 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 was tied to the SiteMap file created in part one. In part three an ASP.NET SiteMapPath (bread crumbs menu) is tied to the SiteMap created in part one and the Menu added in part two.
Read previous parts of the article -> Part 1, Part 2
Clean Up the Master Page
The master page used in parts 1 and 2 was getting cluttered so I clean it up. Here are the steps I took:
1. Removed the Read Me and GetDotNetCode links below the banner header.
2. Merged the two cells below the banner header.
3. Removed the row above the banner header that contained the words: 'Bread Crumbs Menu (Will be added in Part Three)'
Add an ASP.NET 2.0 SiteMapPath Control to the Master Page
An ASP.NET 2.0 SiteMapPath control was drug from the Toolbox to the row under the banner header.
Because a site map with the name Web.sitemap was already present in the web sites root directory, the new control was automatically wired to it. (The site map was added in part one of this article.)
Test the Site Map
Run the application. Select any page from the application, from the left menu. As you do, the SiteMapPath control will display a 'bread crumbs' menu that shows the path to the page you select.

About the ASP.NET SiteMapPath Class
The SiteMapPath control is a site navigation control that reflects data provided by the SiteMap object. The SiteMapPath class displays a set of text or image hyperlinks that enable users to more easily navigate a Web site, while taking a minimal amount of page space.
The SiteMapPath control provides a space-saving way to easily navigate a site and serves as a point of reference for where the currently displayed page is within a site. This type of control is commonly called a breadcrumb, or eyebrow, because it displays a hierarchical path of hyperlinked page names that provides an escape up the hierarchy of pages from the current location. SiteMapDataSource.
For more information:
SiteMap Class
Menu Class
SiteMapPath Class
mike mcintyre http://www.getdotnetcode.com |