SiteMapPath control

The SiteMapPath displays a navigation path (which is also known as a breadcrumb or eyebrow) that shows the user the current page location and displays links as a path back to the home page. The control provides many options for customizing the appearance of the links.

To add a SiteMapPath control to a page

  • Drag the SiteMapPath control from the Toolbox task pane to your page.

The SiteMapPath control obtains navigation data from a site map. This data includes information about the pages in your website, 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 website. For more information about site maps, see ASP.NET Site Maps in the MSDN library.

The simplest way to create a site map is to create an XML file named Web.sitemap that organizes the pages in the site hierarchically. This site map is automatically picked up by the default site-map provider for ASP.NET. The Web.sitemap file must be located in the application root directory.


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.

Example sitemap data in a Web.sitemap file

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

To apply basic formatting schemes to the SiteMapPath control

  1. In Design view, right-click the Login control, and then click Show Common Control Tasks.


    You can also click the Login control in Design view, click the arrow Cc295500.56557a2a-a4ef-4c47-906b-f64b8d530387(en-us,Expression.10).png in the upper-right corner to show the Common Login Tasks menu. Click the arrow again to hide the menu.

  2. On the Common SiteMapPath Tasks menu, click AutoFormat.

  3. In the AutoFormat dialog box, select one of the schemes in the Select a scheme list. The effect of the scheme on your SiteMapPath control is displayed in the Preview area.

  4. Click OK to apply the formatting scheme and close the dialog, or Apply to apply the formatting scheme without closing the dialog.

  5. You can also interactively format the SiteMapPath control, apply styles and change the text.

  6. For a full description of all SiteMapPath control properties, see SiteMapPath in the MSDN library.

  7. The SiteMapPath is composed of various template regions. You can also interactively design these.

To interactively design a template

  1. In Design view, right-click the SiteMapPath control, and then click Show Common Control Tasks.

  2. On the Common SiteMapPath Tasks menu, click Edit Templates. This switches the Wizard into Template Editing Mode.

  3. In the Display dropdown, select the template you would like to edit.

  4. Add text or controls or make changes to the Template.

  5. When you are finished designing your templates, on the Common SiteMapPath Tasks menu, click End Template Editing to return to the standard SiteMapPath design mode.

The SiteMapPath control allows users to navigate backward — from the current page to pages that are higher in the site hierarchy. However, the SiteMapPath control does not allow you to navigate forward — from the current page to another page that is lower 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.

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. For more information, see How to: Programmatically Modify Site-Map Nodes in Memory in the MSDN library.

See also


ASP.NET navigation controls overview

Menu control

TreeView control