Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SiteMapProvider.GetCurrentNodeAndHintNeighborhoodNodes Method

Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the site map nodes in the proximity of the current node.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)
public virtual SiteMapNode GetCurrentNodeAndHintNeighborhoodNodes(
	int upLevel,
	int downLevel
)

Parameters

upLevel
Type: System.Int32

The number of ancestor SiteMapNode generations to fetch. 0 indicates no ancestor nodes are retrieved and -1 indicates that all ancestors might be retrieved and cached by the provider.

downLevel
Type: System.Int32

The number of child SiteMapNode generations to fetch. 0 indicates no descendant nodes are retrieved and a -1 indicates that all descendant nodes might be retrieved and cached by the provider.

Return Value

Type: System.Web.SiteMapNode
A SiteMapNode that represents the currently requested page; otherwise, null, if the SiteMapNode is not found or cannot be returned for the current user.
ExceptionCondition
ArgumentOutOfRangeException

upLevel or downLevel is less than -1.

The default implementation of the GetCurrentNodeAndHintNeighborhoodNodes method returns the CurrentNode property; however, site map providers can override the GetCurrentNodeAndHintNeighborhoodNodes method and provide an optimized implementation that uses custom caching mechanisms to return the current SiteMapNode object, as well as SiteMapNode objects that are in the proximity of the current SiteMapNode.

The upLevel parameter is used to specify how many levels of parent and ancestor nodes to retrieve and cache, along with their immediate children. The downLevel parameter is used to specify how many levels of descendant nodes from the current SiteMapNode to retrieve. If preferred, the ancestor and descendant nodes can be linked to the SiteMapNode that is returned by the

GetCurrentNodeAndHintNeighborhoodNodes method, using the ParentNode and ChildNodes properties. If there are fewer ancestor or child node levels than are specified by upLevel or downLevel, only those that are available are retrieved.

The XmlSiteMapProvider class, which is the default site map provider for ASP.NET, caches the entire site map in memory, which results in little or no overhead when querying the XmlSiteMapProvider for specific SiteMapNode objects.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.