This documentation is archived and is not being maintained.

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

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.

ExceptionCondition
ArgumentNullException

SiteMapProvider is nullptr.

- or -

key is nullptr.

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

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: