SiteMapProvider.GetParentNodeRelativeToCurrentNodeAndHintDownFromParent(Int32, Int32) 方法

定義

當擷取目前所要求之網頁的祖系節點,以及擷取祖系的子代節點時,提供網站導覽提供者的最佳化查閱方法。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

參數

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.

傳回

SiteMapNode

SiteMapNode,表示目前所要求之網頁的祖系 SiteMapNode,但如果找不到目前或祖系 SiteMapNode 或無法為目前使用者傳回,則為 nullA 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.

例外狀況

walkupLevelsrelativeDepthFromWalkup 小於 0。walkupLevels or relativeDepthFromWalkup is less than 0.

備註

類別的預設實值 SiteMapProvider 會提供方法的非優化實值 GetParentNodeRelativeToCurrentNodeAndHintDownFromParent 、呼叫 GetCurrentNodeAndHintAncestorNodesHintNeighborhoodNodes 方法; 不過,網站地圖提供者可以覆寫 GetParentNodeRelativeToCurrentNodeAndHintDownFromParent 方法,並提供優化的執行,以使用自訂快取機制來傳回上階節點並執行其他物件的優化查閱 SiteMapNodeThe 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.

walkupLevels參數是用來指定在抓取目標節點時,要進行的父系和上階節點層級數目。The walkupLevels parameter is used to specify how many levels of parent and ancestor nodes to traverse when retrieving the target node. 如果有比要求更少的層級, null 則會傳回。If fewer levels exist than are requested, null is returned. downLevel參數是用來指定要從目標上階節點中取出的子系節點層級數目。The downLevel parameter is used to specify how many levels of descendant nodes from the target ancestor node to retrieve. 如果偏好的話,可以 SiteMapNode GetParentNodeRelativeToCurrentNodeAndHintDownFromParent 使用 ParentNode 和屬性,將上階和子系節點連結至方法所傳回的 ChildNodesIf 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.

適用於

另請參閱