asp.net.ph

SiteMapPath Class

System.Web.UI.WebControls Namespace


.NET Framework version 2.0

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.

SiteMapPath Class Members

Collapse   Constructors

Visibility Constructor Parameters
public SiteMapPath ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public CurrentNodeStyle Style [ Get ]
public CurrentNodeTemplate ITemplate [ Get , Set ]
public NodeStyle Style [ Get ]
public NodeTemplate ITemplate [ Get , Set ]
public ParentLevelsDisplayed Int32 [ Get , Set ]
public PathDirection PathDirection [ Get , Set ]
public PathSeparator String [ Get , Set ]
public PathSeparatorStyle Style [ Get ]
public PathSeparatorTemplate ITemplate [ Get , Set ]
public Provider SiteMapProvider [ Get , Set ]
public RenderCurrentNodeAsLink Boolean [ Get , Set ]
public RootNodeStyle Style [ Get ]
public RootNodeTemplate ITemplate [ Get , Set ]
public ShowToolTips Boolean [ Get , Set ]
public SiteMapProvider String [ Get , Set ]
public SkipLinkText String [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
protected CreateControlHierarchy ( ) Void
public DataBind ( ) Void
protected InitializeItem ( SiteMapNodeItem item ) Void
protected LoadViewState ( Object savedState ) Void
protected OnDataBinding ( EventArgs e ) Void
protected OnItemCreated ( SiteMapNodeItemEventArgs e ) Void
protected OnItemDataBound ( SiteMapNodeItemEventArgs e ) Void
protected SaveViewState ( ) Object
protected TrackViewState ( ) Void

Collapse   Events

Remarks

The SiteMapPath 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 SiteMapPath 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 SiteMapPath 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 SiteMapPath 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.

Node type Description
root A node that anchors a hierarchical set of nodes.
parent A node that has one or more child nodes, but is not the current node.
current A node that represents the currently displayed page.

Each node displayed by a SiteMapPath is a HyperLink or Literal control that you can apply a template or style to. The templates and styles are applied to nodes according to two rules of precedence:

  • 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 NodeStyle and NodeTemplate properties are applied to all nodes, regardless of their node type. If both these properties are defined, the NodeTemplate takes precedence.

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 SiteMapPath 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 SiteMapPath control is used within a site but no site map provider is configured, the control throws an HttpException exception.

The SiteMapPath 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 SiteMapPath control.

Event Description
ItemCreated Occurs when the SiteMapPath control first creates a SiteMapNodeItem and associates it with a SiteMapNode.
ItemDataBound Occurs when a SiteMapNodeItem is bound to site map data contained by the SiteMapNode.

Classes that derive from SiteMapPath 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 SiteMapPath, derived classes override the CreateControlHierarchy method.

For examples illustrating use of this control, see the individual member types of this class. For syntax information, see SiteMapPath in ASP.NET Syntax for Web Controls.

See Also

ASP.NET Navigation Controls   SiteMapPath Web Server Control Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph