Editar

Partilhar via


SiteMapProvider.GetParentNodeRelativeToCurrentNodeAndHintDownFromParent Method

Definition

Provides an optimized lookup method for site map providers when retrieving an ancestor node for the currently requested page and fetching the descendant nodes for the ancestor.

public:
 virtual System::Web::SiteMapNode ^ GetParentNodeRelativeToCurrentNodeAndHintDownFromParent(int walkupLevels, int relativeDepthFromWalkup);
public virtual System.Web.SiteMapNode GetParentNodeRelativeToCurrentNodeAndHintDownFromParent (int walkupLevels, int relativeDepthFromWalkup);
abstract member GetParentNodeRelativeToCurrentNodeAndHintDownFromParent : int * int -> System.Web.SiteMapNode
override this.GetParentNodeRelativeToCurrentNodeAndHintDownFromParent : int * int -> System.Web.SiteMapNode
Public Overridable Function GetParentNodeRelativeToCurrentNodeAndHintDownFromParent (walkupLevels As Integer, relativeDepthFromWalkup As Integer) As SiteMapNode

Parameters

walkupLevels
Int32

The number of ancestor node levels to traverse when retrieving the requested ancestor node.

relativeDepthFromWalkup
Int32

The number of descendant node levels to retrieve from the target ancestor node.

Returns

A SiteMapNode that represents an ancestor SiteMapNode of the currently requested page; otherwise, null, if the current or ancestor SiteMapNode is not found or cannot be returned for the current user.

Exceptions

walkupLevels or relativeDepthFromWalkup is less than 0.

Remarks

The default implementation of the SiteMapProvider class provides a non-optimized implementation of the GetParentNodeRelativeToCurrentNodeAndHintDownFromParent method, calling the GetCurrentNodeAndHintAncestorNodes and HintNeighborhoodNodes methods; however, site map providers can override the GetParentNodeRelativeToCurrentNodeAndHintDownFromParent method and provide an optimized implementation that uses custom caching mechanisms to return the ancestor node and perform an optimized lookup of the other SiteMapNode objects.

The walkupLevels parameter is used to specify how many levels of parent and ancestor nodes to traverse when retrieving the target node. If fewer levels exist than are requested, null is returned. The downLevel parameter is used to specify how many levels of descendant nodes from the target ancestor node to retrieve. If preferred, the ancestor and descendant nodes can be linked to the SiteMapNode that is returned by the GetParentNodeRelativeToCurrentNodeAndHintDownFromParent method, using the ParentNode and ChildNodes properties.

Applies to

See also