SiteMapResolveEventArgs 클래스

정의

CurrentNode 클래스의 SiteMapProvider 속성을 호출하여 발생된 이벤트에 대한 데이터를 제공합니다.

public ref class SiteMapResolveEventArgs : EventArgs
public class SiteMapResolveEventArgs : EventArgs
type SiteMapResolveEventArgs = class
    inherit EventArgs
Public Class SiteMapResolveEventArgs
Inherits EventArgs
상속
SiteMapResolveEventArgs

예제

다음 코드 예제에서는 처리 하는 방법에 설명 합니다 SiteMapResolve 이벤트와 같은 사이트 탐색 컨트롤에 의해 표시 되는 대상 Url을 수정 하는 ASP.NET 웹 페이지에는 SiteMapPath 컨트롤입니다. 이 예제에서는 현재 페이지의 온라인 게시판 또는 포럼 게시물 페이지입니다. 렌더링할 더 의미 있는 컨텍스트에 관련 된 쿼리 문자열이 포함 된 사이트 탐색, 탐색 컨트롤에 의해 표시 되는 노드의 Url 추가 됩니다.

참고 안전 하 게 액세스 하는 것을 CurrentNode 내에서 속성을 SiteMapResolveEventHandler 클래스. ASP.NET 사이트 탐색 인프라는이 경우 무한 재귀가 발생 하지 않도록 합니다.

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 클래스. 처리 하는 이벤트 처리기 대리자를 추가 하 여 합니다 SiteMapResolve 만들면 이벤트는 SiteMapNode 사용자 지정 사이트 맵 공급자를 구현 하지 않고도 페이지의 표현입니다.

생성자

SiteMapResolveEventArgs(HttpContext, SiteMapProvider)

지정된 SiteMapResolveEventArgsHttpContext 개체를 사용하여 SiteMapProvider 클래스의 새 인스턴스를 초기화합니다.

속성

Context

요청된 노드가 나타내는 페이지 요청의 컨텍스트를 가져옵니다.

Provider

SiteMapProvider 이벤트를 발생시킨 SiteMapResolve 개체를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보