SiteMapNode Constructor (SiteMapProvider, String, String, String, String, IList, NameValueCollection, NameValueCollection, String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the SiteMapNode class using the specified site map provider that manages the node, URL, title, description, roles, additional attributes, and explicit and implicit resource keys for localization.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

public SiteMapNode(
	SiteMapProvider provider,
	string key,
	string url,
	string title,
	string description,
	IList roles,
	NameValueCollection attributes,
	NameValueCollection explicitResourceKeys,
	string implicitResourceKey
)

Parameters

provider
Type: System.Web.SiteMapProvider

The SiteMapProvider with which the node is associated.

key
Type: System.String

A provider-specific lookup key.

url
Type: System.String

The URL of the page that the node represents within the site.

title
Type: System.String

A label for the node, often displayed by navigation controls.

description
Type: System.String

A description of the page that the node represents.

roles
Type: System.Collections.IList

An IList of roles that are allowed to view the page represented by the SiteMapNode.

attributes
Type: System.Collections.Specialized.NameValueCollection

A NameValueCollection of additional attributes used to initialize the SiteMapNode.

explicitResourceKeys
Type: System.Collections.Specialized.NameValueCollection

A NameValueCollection of explicit resource keys used for localization.

implicitResourceKey
Type: System.String

An implicit resource key used for localization.

Exception Condition
ArgumentNullException

SiteMapProvider is null.

- or -

key is null.

The XmlSiteMapProvider class, which is the default SiteMapProvider provider implementation for ASP.NET, uses the SiteMapNode.Url property as a lookup key, if one is provided for the node (if a URL is not provided, a tracking identifier is generated for the node). Therefore, any SiteMapNode object that provides a URL and is used by the XmlSiteMapProvider must have a unique URL within the scope of the provider.

The NameValueCollection collection of attributes that the SiteMapNode is created with is available through the Attributes property, and makes it easy to apply additional attributes to a site map node and extend its capabilities without deriving a custom class to do so.

Supply an IList collection of roles to provide a set of roles that can view the node when the SecurityTrimmingEnabled property returns true. For more information, see SecurityTrimmingEnabled.

The XmlSiteMapProvider provider uses the SiteMapNode.Url property as a lookup key. Therefore, any SiteMapNode that is used by the XmlSiteMapProvider must have a unique URL within the scope of the provider.

If no title or description is provided, calls to the Title or Description properties return an String.Empty field.

To programmatically specify resources for localization, either set the value of implicitResourceKey to a unique name that will be used to identify localized resources for the node or set explicitResourceKeys to a NameValueCollection collection of name/value pairs where name is the node property or custom attribute to localize and value contains localization values for the node property or custom attribute. The localized values can then be set in the appropriate .resx files. For more information about how to localize the Title, Description, and any custom properties of a SiteMapNode object, see How to: Localize Site-Map Data. For the syntax requirements of the explicitResourceKeys collection, see NameValueCollection.

.NET Framework
Available since 2.0
Return to top
Show: