asp.net.ph

Skip Navigation Links

Introduction to the SiteMapPath Control

Controls You Can Use on Web Forms   ASP.NET Navigation Controls   SiteMapPath Control


The SiteMapPath control displays a navigation path, which is also known as a breadcrumb or eyebrow, that displays links as a path from the current page back to the home page of the Web site. On an ASP.NET page, the SiteMapPath control displays something like the following:

Home   Services   Training

The SiteMapPath control obtains navigation data from a site map. This data includes information about the pages in your Web site, such as the URL, title, description, and location in the navigation hierarchy. Storing your navigation data in one place makes it easier to add and remove items in the navigational menus of your Web site.

In earlier versions of ASP and ASP.NET, when you added a page to your Web site and then added a link to that new page from every other page in the Web site, you had to add the links manually, include a common file, or develop custom navigation functionality. ASP.NET version 2.0 includes navigation controls that make navigational menus easy to create, customize, and maintain.

The following code example shows site-map data that is included in a Web.sitemap file.

<siteMap>
   <siteMapNode title="Home" description="Home" url="~/default.aspx" >
      <siteMapNode title="Services" description="Services we offer"
         url="~/Services.aspx">
         <siteMapNode title="Training" description="Training classes"
            url="~/Training.aspx" />
         <siteMapNode title="Consulting" description="Consulting services"
            url="~/Consulting.aspx" />
      </siteMapNode>
   </siteMapNode>
</siteMap>

NOTE: Only pages that are listed in the site map can display navigation data in the SiteMapPath control. If you place a SiteMapPath control on a page that is not listed in the site map, the control will display nothing to the client.

You can use the SiteMapPath control to create site navigation without code and without binding data. The control can read and render the site-map information automatically. However, if needed, you can also use the SiteMapPath control to alter site-map data.

The SiteMapPath control allows users to navigate backward — from the current page to pages that are higher in the site hierarchy. For example, you can use the SiteMapPath control in newsgroup or message board applications to allow users to see the path to the article that they are currently browsing.

The SiteMapPath control, however, does not allow you to navigate forward — from the current page to another page that is lower in the site hierarchy.

See Also

Adding SiteMapPath Controls to a Web Forms Page



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note