SiteMapResolveEventArgs SiteMapResolveEventArgs SiteMapResolveEventArgs SiteMapResolveEventArgs Class

定義

CurrentNode クラスの SiteMapProvider プロパティを呼び出すことによって発生するイベントに関するデータを提供します。Provides data for an event that is raised by calling the CurrentNode property of the SiteMapProvider class.

public ref class SiteMapResolveEventArgs : EventArgs
public class SiteMapResolveEventArgs : EventArgs
type SiteMapResolveEventArgs = class
    inherit EventArgs
Public Class SiteMapResolveEventArgs
Inherits EventArgs
継承
SiteMapResolveEventArgsSiteMapResolveEventArgsSiteMapResolveEventArgsSiteMapResolveEventArgs

次のコード例は、処理する方法を示します、SiteMapResolveなど、サイト ナビゲーション コントロールによって表示される対象の Url を変更する ASP.NET Web ページ上のイベント、SiteMapPathコントロール。The following code example demonstrates how to handle the SiteMapResolve event on an ASP.NET Web page to modify the target URLs that are displayed by a site navigation control, such as the SiteMapPath control. この例では、現在のページは、オンラインの掲示板またはフォーラムの投稿のページが。In this example, the current page is a post page in an online bulletin board or forum. わかりやすい表示するためには、コンテキストに関連するクエリ文字列によるサイト ナビゲーション、ナビゲーション コントロールによって表示されるノードの Url が追加されます。To render more meaningful site navigation, the URLs of the nodes displayed by the navigation control are appended with query strings that are relevant to the context.

にアクセスするには、安全では、CurrentNode内からのプロパティ、SiteMapResolveEventHandlerクラス。Note It is safe to access the CurrentNode property from within the SiteMapResolveEventHandler class. ASP.NET サイト ナビゲーションのインフラストラクチャは、無限再帰は、ここでは保護します。The ASP.NET site navigation infrastructure guards against infinite recursion, in this case.

private void Page_Load(object sender, EventArgs e)
{
    // The ExpandForumPaths method is called to handle
    // the SiteMapResolve event.
    SiteMap.SiteMapResolve +=
      new SiteMapResolveEventHandler(this.ExpandForumPaths);
}

private SiteMapNode ExpandForumPaths(Object sender, SiteMapResolveEventArgs e)
{
    // The current node represents a Post page in a bulletin board forum.
    // Clone the current node and all of its relevant parents. This
    // returns a site map node that a developer can then
    // walk, modifying each node.Url property in turn.
    // Since the cloned nodes are separate from the underlying
    // site navigation structure, the fixups that are made do not
    // effect the overall site navigation structure.
    SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
    SiteMapNode tempNode = currentNode;

    // Obtain the recent IDs.
    int forumGroupID = GetMostRecentForumGroupID();
    int forumID = GetMostRecentForumID(forumGroupID);
    int postID = GetMostRecentPostID(forumID);

    // The current node, and its parents, can be modified to include
    // dynamic querystring information relevant to the currently
    // executing request.
    if (0 != postID)
    {
        tempNode.Url = tempNode.Url + "?PostID=" + postID.ToString();
    }

    if ((null != (tempNode = tempNode.ParentNode)) &&
        (0 != forumID))
    {
        tempNode.Url = tempNode.Url + "?ForumID=" + forumID.ToString();
    }

    if ((null != (tempNode = tempNode.ParentNode)) &&
        (0 != forumGroupID))
    {
        tempNode.Url = tempNode.Url + "?ForumGroupID=" + forumGroupID.ToString();
    }

    return currentNode;
}
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    ' The ExpandForumPaths method is called to handle
    ' the SiteMapResolve event.
    AddHandler SiteMap.SiteMapResolve, AddressOf Me.ExpandForumPaths

End Sub

Private Function ExpandForumPaths(ByVal sender As Object, ByVal e As SiteMapResolveEventArgs) As SiteMapNode
    ' The current node represents a Post page in a bulletin board forum.
    ' Clone the current node and all of its relevant parents. This
    ' returns a site map node that a developer can then
    ' walk, modifying each node.Url property in turn.
    ' Since the cloned nodes are separate from the underlying
    ' site navigation structure, the fixups that are made do not
    ' effect the overall site navigation structure.
    Dim currentNode As SiteMapNode = SiteMap.CurrentNode.Clone(True)
    Dim tempNode As SiteMapNode = currentNode

    ' Obtain the recent IDs.
    Dim forumGroupID As Integer = GetMostRecentForumGroupID()
    Dim forumID As Integer = GetMostRecentForumID(forumGroupID)
    Dim postID As Integer = GetMostRecentPostID(forumID)

    ' The current node, and its parents, can be modified to include
    ' dynamic querystring information relevant to the currently
    ' executing request.
    If Not (0 = postID) Then
        tempNode.Url = tempNode.Url & "?PostID=" & postID.ToString()
    End If

    tempNode = tempNode.ParentNode
    If Not (0 = forumID) And Not (tempNode Is Nothing) Then
        tempNode.Url = tempNode.Url & "?ForumID=" & forumID.ToString()
    End If

    tempNode = tempNode.ParentNode
    If Not (0 = ForumGroupID) And Not (tempNode Is Nothing) Then
        tempNode.Url = tempNode.Url & "?ForumGroupID=" & forumGroupID.ToString()
    End If

    Return currentNode

End Function

注釈

SiteMapResolveEventArgsクラスが使用されて、ResolveSiteMapNodeのサブスクライバーを有効にするメソッド、SiteMapResolveイベントのインスタンスを返す、SiteMapNodeクラス。The SiteMapResolveEventArgs class is used in the ResolveSiteMapNode method to enable subscribers to the SiteMapResolve event to return an instance of the SiteMapNode class. 処理するイベント ハンドラー デリゲートを追加することで、SiteMapResolveイベントを作成できます、SiteMapNodeカスタム サイト マップ プロバイダーを実装することがなく、ページの表現。By adding an event handler delegate to handle the SiteMapResolve event, you can create a SiteMapNode representation of a page without implementing a custom site map provider.

コンストラクター

SiteMapResolveEventArgs(HttpContext, SiteMapProvider) SiteMapResolveEventArgs(HttpContext, SiteMapProvider) SiteMapResolveEventArgs(HttpContext, SiteMapProvider) SiteMapResolveEventArgs(HttpContext, SiteMapProvider)

指定した SiteMapResolveEventArgs オブジェクトと HttpContext オブジェクトを使用して、SiteMapProvider クラスの新しいインスタンスを初期化します。Initializes a new instance of the SiteMapResolveEventArgs class using the specified HttpContext and SiteMapProvider objects.

プロパティ

Context Context Context Context

要求されたノードが表すページ要求のコンテキストを取得します。Gets the context of the page request that the requested node represents.

Provider Provider Provider Provider

SiteMapProvider イベントを発生させる SiteMapResolve オブジェクトを取得します。Gets the SiteMapProvider object that raised the SiteMapResolve event.

メソッド

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

適用対象

こちらもご覧ください