System.Web 2.0.0.0 System.Web.UI.HierarchicalDataSourceControl System.ComponentModel.IListSource System.Web.UI.IDataSource System.Web.UI.ParseChildren(true) System.ComponentModel.Designer("System.Web.UI.Design.WebControls.SiteMapDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.Web.UI.PersistChildren(false) In this topic: Introduction Specifying the Starting Node Retrieving Site Map Data Declarative Syntax

Introduction

The 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 enables Web server controls that are not specifically site navigation controls, such as the , , and 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 control, which is designed specifically as a site navigation control and therefore does not need an instance of the control.

Specifying the Starting Node

The binds to site map data and presents its view based on a specified starting node in the site map hierarchy. By default, it is the root node of the hierarchy but it can also be any node within the hierarchy. The starting node is identified by the values of several properties as follows: Starting Node Property Values The root node of the hierarchy (the default setting). The is false. The is not set. The node that represents the currently viewed page. The is true. The is not set. A specific node of the hierarchy. The is false. The is set. If the 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 control. The negative or positive integer value of the identifies the number of levels up or down the site map hierarchy from the starting node that is identified by the and properties to offset the starting node of the subtree that is exposed by data source control. If the 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 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 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 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.

Retrieving Site Map Data

Site map data is retrieved from an object, such as , 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 and can obtain the list of available providers by accessing the collection. Like all data source controls, every instance of a is associated with a single helper object, known as a data source view. The is a view on the site map data, according to the properties of the data source, and is retrieved by calling the method. The maintains the object that the controls bind to. 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 property. The 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.

Declarative Syntax

<asp:SiteMapDataSource     EnableTheming="True|False"     EnableViewState="True|False"     ID="string"     OnDataBinding="DataBinding event handler"     OnDisposed="Disposed event handler"     OnInit="Init event handler"     OnLoad="Load event handler"     OnPreRender="PreRender event handler"     OnUnload="Unload event handler"     runat="server"     ShowStartingNode="True|False"     SiteMapProvider="string"     SkinID="string"     StartFromCurrentNode="True|False"     StartingNodeOffset="integer"     StartingNodeUrl="uri"     Visible="True|False" />
Provides a data source control that Web server controls and other controls can use to bind to hierarchical site map data.
Constructor To be added. Initializes a new instance of the class. 2.0.0.0 Property System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.Browsable(false) System.Boolean To be added. The property calls the static method of the class. Gets a value indicating whether the data source control contains a collection of data source view objects. 2.0.0.0 Method System.Web.UI.HierarchicalDataSourceView To be added. Retrieves a single view on the site map data for the object according to the starting node and other properties of the data source. A helper object on the site map data, starting with the node that is identified by the or its child, if the is false. The URL of the starting node, specified by the . 2.0.0.0 Method System.Collections.IList Use the method to retrieve a set of objects that can be used as sources for the control. Site map data source controls encapsulate their lists of data as objects. Therefore, when associated with one or more objects, a control represents a list source object and the method returns a list containing one element — the data source control itself. The method calls the static method to retrieve a list of objects that can be used as sources of data. The checks whether the method returns a valid collection of view names. If it does, the returns a list containing one element — the . Retrieves a list of data source controls that can be used as sources of lists of data. An of data source controls that can be used as sources of lists of data. 2.0.0.0 Method System.Web.UI.DataSourceView The parameter is the URL for the root node of the view, not the name of the data source view as it is with other data source controls that support named views. Retrieves a named view on the site map data of the site map provider according to the starting node and other properties of the data source. A helper object on the site map data, according to the starting node that is identified by the property or its child, if the is false. The name of the data source view to retrieve. 2.0.0.0 Method System.Collections.ICollection The method returns a collection with one element (the default name) instead of null so that the method returns true. Retrieves a collection of named views for the data source control. An of named objects associated with the . Because the supports only one named view, the method returns an with one element. 2.0.0.0 Property System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.Browsable(false) System.Web.SiteMapProvider To be added. Use the property to specify the site map provider instance to use with the data source control. The instance can be different than the provider that is identified by the property, if set. Gets or sets a object that is associated with the data source control. 2.0.0.0 Property System.ComponentModel.DefaultValue(true) System.Boolean To be added. The property is evaluated during calls to the and methods, when the node tree that is returned by these methods is populated. The value of the property is stored in view state. Gets or sets a value indicating whether the starting node is retrieved and displayed. 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.String To be added. The value of the property is stored in view state. Gets or sets the name of the site map provider that the data source binds to. 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. The property is evaluated during calls to the and the methods to help determine which site map node to use as a starting point to build the node tree. The and properties are mutually exclusive — if you set the property, ensure that the property is false. The value of the property is stored in view state. Gets or sets a value indicating whether the site map node tree is retrieved using the node that represents the current page. 2.0.0.0 Property System.ComponentModel.DefaultValue(0) System.Int32 To be added. If the 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 control. The negative or positive integer value of the identifies the number of levels up or down the site map hierarchy from the starting node that is identified by the and properties to offset the starting node of the subtree that is exposed by data source control. If the identified starting node is the node that represents the currently requested page, the is ignored. If the 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 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 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 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. The value of the property is stored in view state. Gets or sets a positive or negative integer offset from the starting node that determines the root hierarchy that is exposed by the data source control. 2.0.0.0 Property System.Web.UI.UrlProperty System.ComponentModel.Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") System.ComponentModel.DefaultValue("") System.String To be added. The property 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 with the property or set the property to true. The value of the property is stored in view state. Gets or sets a node in the site map that the data source then uses as a reference point to retrieve nodes from a hierarchical site map. 2.0.0.0 Property 2.0.0.0 System.Boolean To be added. This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. Gets a value that indicates whether the collection is a collection of objects. Method 2.0.0.0 System.Collections.IList This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. For a description of this member, see . An of data source controls that can be used as sources of lists of data. Method 2.0.0.0 System.Web.UI.DataSourceView This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. For a description of this member, see . A helper object on the site map data, according to the starting node identified by the property or its child, if the is false. The URL of the root node of the view. Method 2.0.0.0 System.Collections.ICollection This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface. For a description of this member, see . An of named objects associated with the . Because the supports only one named view, the returns a collection containing one element set to .