asp.net.ph

SiteMapDataSource Class

System.Web.UI.WebControls Namespace


.NET Framework version 2.0

Provides a data source control that Web server controls and other controls can use to bind to hierarchical site map data.

SiteMapDataSource Class Members

Collapse   Constructors

Visibility Constructor Parameters
public SiteMapDataSource ( )

Collapse   Properties

Visibility Name Value Type Accessibility
public ContainsListCollection Boolean [ Get ]
public Provider SiteMapProvider [ Get , Set ]
public ShowStartingNode Boolean [ Get , Set ]
public SiteMapProvider String [ Get , Set ]
public StartFromCurrentNode Boolean [ Get , Set ]
public StartingNodeOffset Int32 [ Get , Set ]
public StartingNodeUrl String [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
protected GetHierarchicalView ( String viewPath ) HierarchicalDataSourceView
public GetList ( ) IList
public GetView ( String viewName ) DataSourceView
public GetViewNames ( ) ICollection

Remarks

The SiteMapDataSource control is a data source to the site map data that is stored by the site map providers that are configured for your site. The SiteMapDataSource enables Web server controls that are not specifically site navigation controls, such as the TreeView, Menu, and DropDownList controls, to bind to hierarchical site map data. You can use these Web server controls to display a site map as a table of contents or to actively navigate a site. Alternatively, you can use the SiteMapPath control, which is designed specifically as a site navigation control and therefore does not need an instance of the SiteMapDataSource control.

The SiteMapDataSource binds to site map data and presents its view based on a specified starting node in the site map hierarchy. By default, the starting node is the root node of the hierarchy, but you can set the starting node to any node. The starting point can be a node that is relative to the current position in the site map or to an absolute position. You can specify the starting node by setting the StartingNodeUrl property.

The starting node is identified by the values of several SiteMapDataSource properties as follows:

Starting Node Property Values
The root node of the hierarchy ( the default setting ). The StartFromCurrentNode is false. The StartingNodeUrl is not set.
The node that represents the currently viewed page. The StartFromCurrentNode is true. The StartingNodeUrl is not set.
A specific node of the hierarchy. The StartFromCurrentNode is false. The StartingNodeUrl is set.

If the StartingNodeOffset property is set to a value other than 0, it affects the starting node and with it the site map data hierarchy that is exposed by the SiteMapDataSource control. The negative or positive integer value of the StartingNodeOffset identifies the number of levels up or down the site map hierarchy from the starting node that is identified by the StartFromCurrentNode and StartingNodeUrl properties to offset the starting node of the subtree that is exposed by data source control.

If the StartingNodeOffset property is set to a negative number -n, the starting node of the subtree that is exposed by the data source control is the ancestor node n hierarchical levels above the identified starting node. If the value n is greater than the number of ancestor levels in the hierarchical tree, the starting node of the subtree is the root node of the site map hierarchy.

If the StartingNodeOffset property is set to a positive number +n, the starting node of the subtree that is exposed is a child node n levels below the identified starting node. Because more than one branch of child nodes might exist in the hierarchy, the SiteMapDataSource attempts to resolve a child node directly on the path between the identified starting node and the node that represents the currently requested page, if possible. If the node that represents the currently requested page is not in the subtree of the identified starting node, the value of the StartingNodeOffset property is ignored. If the node that represents the currently requested page is less than n levels below the identified starting node, the currently requested page node is used as the starting node.

Site map data is retrieved from a SiteMapProvider object, such as XmlSiteMapProvider, which is the default site map provider for ASP.NET. You can specify any provider that is configured for your site to provide the site map data to the SiteMapDataSource and can obtain the list of available providers by accessing the SiteMap.Providers collection.

Like all data source controls, every instance of a SiteMapDataSource is associated with a single helper object, known as a data source view. The SiteMapDataSourceView is a view on the site map data, according to the properties of the data source, and is retrieved by calling the GetHierarchicalView method. The SiteMapDataSourceView maintains the SiteMapNodeCollection object that the controls bind to.

The SiteMapDataSource is specialized for navigation data, and does not support common data source operations such as sorting, filtering, paging, caching, or data record operations such as updates, insertions or deletions.

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

See Also

ASP.NET Data Source Controls   SiteMapDataSource 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