Introducing Breadcrumb Navigation


Do you know what breadcrumbs are? No, I'm not talking about the means by which Hansel and Gretel found their way out of the forest and back home, but that's where this expression may originally come from. In the context of web development, breadcrumbs refer to the display of the page's position in the navigation hierarchy.

ASP.NET 2.0 offers a control that specially addresses the positioning display. This control is called SiteMapPath and you can easily position it on the page without assigning a data source. In this case, the application of Master Pages makes absolute sense as well:

 You are here: <asp:sitemappath  runat="server"> </asp:sitemappath> 

Based on the previous example, Figure 5-3 shows the application of this new control.

click to expand
Figure 5-3: The new SiteMapPath control offers your visitors a way to see where they actually are.

Customizing the SiteMapPath Control

The SiteMapPath control is a prime example for adaptability. With the help of various properties, you can define how the current position is shown. With the Path-Separator property, for example, you can indicate the separator, and with the RenderCurrentNodeAsLink property you may define if the current page can be accessed by a link. You can even show a tool tip with a description of each individual element of the navigation. You may customize all the areas visually with styles, of course.

If all of these ways to influence the behavior of the control aren't enough for you, the following individual templates may be appropriate:

  • NodeTemplate

  • CurrentNodeTemplate

  • RootNodeTemplate

  • PathSeparatorTemplate

Still not satisfied? Then take the two events ItemCreated and ItemDataBound and do whatever you want with them.




ASP. NET 2.0 Revealed
ASP.NET 2.0 Revealed
ISBN: 1590593375
EAN: 2147483647
Year: 2005
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net