Displays a set of text or image hyperlinks that enable users to more easily navigate a Web site, while taking a minimal amount of page space.
Assembly: System.Web (in System.Web.dll)
The control is a site navigation control that reflects data provided by the SiteMap object. It provides a space-saving way to easily navigate a site and serves as a point of reference for where the currently displayed page is within a site. This type of control is commonly called a breadcrumb, or eyebrow, because it displays a hierarchical path of hyperlinked page names that provides an escape up the hierarchy of pages from the current location. SiteMapDataSource. The is useful for sites that have deep hierarchical page structures, but where a TreeView or Menu might require too much space on a page.
The control works directly with your Web site's site map data. If you use it on a page that is not represented in your site map, it will not be displayed. For more information about site maps, see ASP.NET Site Navigation Overview.
The is made up of nodes. Each element in the path is called a node and is represented by a SiteMapNodeItem object. The node that anchors the path and represents the base of the hierarchical tree is called the root node. The node that represents the currently displayed page is the current node. Any other node between the current node and root node is a parent node. The following table describes the three different node types.
A node that anchors a hierarchical set of nodes.
A node that has one or more child nodes, but is not the current node.
A node that represents the currently displayed page.
If a template is defined for a node, it overrides any style defined for the node.
Templates and styles that are specific to types of nodes override general templates and styles defined for all nodes.
The CurrentNodeTemplate and CurrentNodeStyle properties are applied to nodes that represent the currently displayed page. If a NodeTemplate is defined in addition to the CurrentNodeTemplate, it is ignored. If a NodeStyle is defined in addition to the CurrentNodeStyle, it is merged with the CurrentNodeStyle to create a merged style. This merged style uses all the elements of the CurrentNodeStyle, plus any additional elements of the NodeStyle that do not conflict with the CurrentNodeStyle.
The RootNodeTemplate and RootNodeStyle properties are applied to the node that represents the root of the site navigation hierarchy. If a NodeTemplate is defined in addition to the RootNodeTemplate, it is ignored. If a NodeStyle is defined in addition to the RootNodeStyle, it is merged with the RootNodeStyle to create a merged style. This merged style uses all the elements of the RootNodeStyle, plus any additional elements of the NodeStyle that did not conflict with the CurrentNodeStyle. Finally, if the currently displayed page is the root page of the site, the RootNodeTemplate and RootNodeStyle are used instead of the CurrentNodeTemplate or CurrentNodeStyle.
The control uses the site map provider identified by the SiteMapProvider property as its data source for site navigation information. If no provider is specified, it uses the default provider for the site, identified in the SiteMap.Provider property. Typically, this is an instance of the default site map provider for ASP.NET, the XmlSiteMapProvider. If the control is used within a site but no site map provider is configured, the control throws an HttpException exception.
The control also provides events that you can program against. This allows you to run a custom routine whenever an event occurs. The following table lists the events supported by the control.
Classes that derive from override the InitializeItem method to customize the SiteMapNodeItem controls contained by the navigation control. For complete control over the way SiteMapNodeItem objects are created and added to the , derived classes override the CreateControlHierarchy method.
The markup rendered by default for this control might not conform to accessibility standards such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.
The following code example uses a control declaratively in a Web Forms page. This example demonstrates some of the rules of precedence that govern the order with which templates and styles are applied to nodes.
The previous example uses the default site map provider and a Web.sitemap file with the following structure.
<siteMap> <siteMapNode title="WebForm1" description="WebForm1" url="WebForm1.aspx" > <siteMapNode title="WebForm2" description="WebForm2" url="WebForm2.aspx"/> </siteMapNode> </siteMap>
The following code example demonstrates extends the control and adds new functionality to it by overriding the InitializeItem method. The DropDownSiteMapPath control adds a DropDownList after the current node, to enable easy navigation to pages that are child nodes of the current page. This example demonstrates how to work with SiteMapNodeItem objects, including checking their SiteMapNodeItemType and calling the OnItemCreated method after the items are created.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.