SiteMapResolveEventHandler デリゲートとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SiteMapResolveEventHandler デリゲートの意味・解説 

SiteMapResolveEventHandler デリゲート

メモ : このデリゲートは、.NET Framework version 2.0新しく追加されたものです。

クラス SiteMapProvider または静的クラス SiteMapインスタンスによる SiteMapResolve イベント処理するメソッド表します

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Delegate Function
 SiteMapResolveEventHandler ( _
    sender As Object, _
    e As SiteMapResolveEventArgs _
) As SiteMapNode
Dim instance As New SiteMapResolveEventHandler(AddressOf
 HandlerMethod)
public delegate SiteMapNode SiteMapResolveEventHandler (
    Object sender,
    SiteMapResolveEventArgs e
)
public delegate SiteMapNode^ SiteMapResolveEventHandler (
    Object^ sender, 
    SiteMapResolveEventArgs^ e
)
/** @delegate */
public delegate SiteMapNode SiteMapResolveEventHandler (
    Object sender, 
    SiteMapResolveEventArgs e
)
JScript では、デリゲート使用できますが、新規に宣言することはできません。

パラメータ

sender

イベント ソースである、SiteMapProvider クラスインスタンス

e

イベント データ格納している SiteMapResolveEventArgs。

戻り値
SiteMapResolveEventHandler 操作結果を表す SiteMapNode。

解説解説
使用例使用例

SiteMapResolve イベントASP.NET Web ページ処理して、SiteMapPath コントロールなどのサイト ナビゲーション コントロールにより表示される URL変更する方法示したコード例次に示します。この例では、現在のページオンライン掲示板またはフォーラム投稿ページです。より意味のあるサイト ナビゲーション実現するため、ナビゲーション コントロールにより表示されるノードURL が、コンテキスト関連するクエリ文字列付加されます。

メモメモ

CurrentNode プロパティSiteMapResolveEventHandler クラスの中からアクセスしても安全です。この場合ASP.NET サイト ナビゲーション インフラストラクチャが無限の再帰防ぎます

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

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;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.Web 名前空間
SiteMapResolveEventArgs クラス
SiteMap.SiteMapResolve イベント


このページでは「.NET Framework クラス ライブラリ リファレンス」からSiteMapResolveEventHandler デリゲートを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSiteMapResolveEventHandler デリゲートを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSiteMapResolveEventHandler デリゲートを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SiteMapResolveEventHandler デリゲート」の関連用語

SiteMapResolveEventHandler デリゲートのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SiteMapResolveEventHandler デリゲートのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS