The last touch I want to add to my site is support for a
“bread-crumb” UI paradigm near the top of the page that will help users easily
figure out where they currently are within the application. The good news is
that this is super easy with ASP.NET 2.0 and the Site Navigation system.
All I need to-do is add the new <asp:SiteMapPath>
control to my “header” <div>:
<span class="title">Northwind Data Tutorials</span>
<asp:SiteMapPath ID="Breadcrumb" runat="server"></asp:SiteMapPath>
This will then output the site hierarchy of the current node
relative to the root node of the site map. For example, if I was on “Sample1”
within the “Basic Data Samples” section of the site, the above control would
automatically output this:
If I click on the “Basic Data Samples” hyperlink (which is
automatically generated by the breadcrumb – or I could just use the menu link),
it would adjust to:
No code is required.