11.3. Adding a Breadcrumb Feature to Your Pages
A breadcrumb (implemented through the ASP.NET SiteMapPath control) displays the hierarchy as a single line of hyperlinks. Web designers usually place it near the top of the page. While the user navigates, ASP.NET tracks the current location according to the filename and matches the filename with what it finds in the Web.sitemap file. It can then look backward in the hierarchy to provide a trail to the starting point, including the levels in between.
 |
If the breadcrumb doesn't show on a page, make sure that the page's filename (for example, lcl.aspx) is somewhere in the Web.sitemap file. If the filename's not there, it can't be tracked, and the SiteMapPath control won't have anything to display.
|
|
11.3.1. Creating a breadcrumb on a master page
This example puts the breadcrumb on a master page because it's far more convenient than repeatedly adding navigation controls to individual pages in a site. Follow these steps to add a breadcrumb to a master page:
If you haven't already done so, add a Web.sitemap file to your project (File
New File
Site Map) and add data from Listing 11-2.
Add a master page to your project (FileNew FileMaster Page)