SiteMapNodeItem クラスとは? わかりやすく解説

SiteMapNodeItem クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

SiteMapNodeItem クラスは、SiteMapPath コントロールによって使用され機能的に SiteMapNode を表します

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

Public Class SiteMapNodeItem
    Inherits WebControl
    Implements IDataItemContainer, INamingContainer
Dim instance As SiteMapNodeItem
public class SiteMapNodeItem : WebControl,
 IDataItemContainer, INamingContainer
public ref class SiteMapNodeItem : public
 WebControl, IDataItemContainer, INamingContainer
public class SiteMapNodeItem extends WebControl
 implements IDataItemContainer, INamingContainer
public class SiteMapNodeItem extends
 WebControl implements IDataItemContainer, INamingContainer
解説解説

SiteMapPath コントロールCompositeControl です。つまり、このコントロールは、数多くの他の Web サーバー コントロール構成されるユーザー インターフェイス表示しますSiteMapPath コントロールは、サイト用に構成されSiteMap とその SiteMapNode オブジェクト直接連携して機能しますが、SiteMapNode オブジェクトWeb サーバー コントロールではありません。SiteMapNodeItem クラスは、SiteMapNode クラス対すWeb サーバー コントロール ラッパーです。これにより、一般的なナビゲーション データ アイテムユーザー インターフェイス アイテムとの機能的な違い維持しながら、SiteMapPath コントロールSiteMapNodeデータ表示できます

SiteMapPath コントロールは、その Controls コレクションサイト マップの各ノード内部的に保持しますSiteMapPath は、その子コントロール種々のスタイルテンプレート、および順序表示できるため、表示順序とは関係なく、機能的に異なる型のノード区別できますこうした理由から、それぞれの SiteMapNodeItem特定の型を使用して作成されます (指定できる型は、SiteMapNodeItemType 列挙体に記載されています)。

SiteMapNodeItem クラスコード内で直接使用するのは、SiteMapPath コントロール拡張する計画や、類似の機能を持つコントロール記述する計画がある場合だけにしてください

使用例使用例

SiteMapPath から派生したクラスの InitializeItem メソッド内で SiteMapNodeItem オブジェクトの作成および操作を行う方法次のコード例示します。このコード例は、SiteMapPath クラストピック取り上げているコード例一部分です。

Private Sub AddDropDownListAfterCurrentNode(item
 As SiteMapNodeItem)

   Dim childNodes As SiteMapNodeCollection
 = item.SiteMapNode.ChildNodes

   ' Only do this work if there are child nodes.
   If Not (childNodes Is
 Nothing) Then

      ' Add another PathSeparator after the CurrentNode.
      Dim finalSeparator As New
 SiteMapNodeItem(item.ItemIndex, SiteMapNodeItemType.PathSeparator)

      Dim eventArgs As New
 SiteMapNodeItemEventArgs(finalSeparator)

      InitializeItem(finalSeparator)
      ' Call OnItemCreated every time a SiteMapNodeItem is
      ' created and initialized.
      OnItemCreated(eventArgs)

      ' The pathSeparator does not bind to any SiteMapNode, so
      ' do not call DataBind on the SiteMapNodeItem.
      item.Controls.Add(finalSeparator)

      ' Create a DropDownList and populate it with the children of the
      ' CurrentNode. There are no styles or templates that are applied
      ' to the DropDownList control. If OnSelectedIndexChanged is raised
,
      ' the event handler redirects to the page selected.
      ' The CurrentNode has child nodes.
      Dim ddList As New
 DropDownList()
      ddList.AutoPostBack = True

      AddHandler ddList.SelectedIndexChanged, AddressOf
 Me.DropDownNavPathEventHandler

      ' Add a ListItem to the DropDownList for every node in the
      ' SiteMapNodes collection.
      Dim node As SiteMapNode
      For Each node In 
 childNodes
         ddList.Items.Add(New ListItem(node.Title, node.Url))
      Next node

      item.Controls.Add(ddList)
   End If
End Sub 'AddDropDownListAfterCurrentNode

private void AddDropDownListAfterCurrentNode(SiteMapNodeItem
 item) {

    SiteMapNodeCollection childNodes = item.SiteMapNode.ChildNodes;

    // Only do this work if there are child nodes.
    if (childNodes != null) {

        // Add another PathSeparator after the CurrentNode.
        SiteMapNodeItem finalSeparator =
            new SiteMapNodeItem(item.ItemIndex,
                                SiteMapNodeItemType.PathSeparator);

        SiteMapNodeItemEventArgs eventArgs =
            new SiteMapNodeItemEventArgs(finalSeparator);

        InitializeItem(finalSeparator);
        // Call OnItemCreated every time a SiteMapNodeItem is
        // created and initialized.
        OnItemCreated(eventArgs);

        // The pathSeparator does not bind to any SiteMapNode, so
        // do not call DataBind on the SiteMapNodeItem.
        item.Controls.Add(finalSeparator);

        // Create a DropDownList and populate it with the children of
 the
        // CurrentNode. There are no styles or templates that are applied
        // to the DropDownList control. If OnSelectedIndexChanged is
 raised,
        // the event handler redirects to the page selected.
        // The CurrentNode has child nodes.
        DropDownList ddList = new DropDownList();
        ddList.AutoPostBack = true;

        ddList.SelectedIndexChanged += new EventHandler(this.DropDownNavPathEventHandler);

        // Add a ListItem to the DropDownList for every node in the
        // SiteMapNodes collection.
        foreach (SiteMapNode node in childNodes)
 {
            ddList.Items.Add(new ListItem(node.Title, node.Url));
        }

        item.Controls.Add(ddList);
    }
}
private void AddDropDownListAfterCurrentNode(SiteMapNodeItem
 item)
{
    SiteMapNodeCollection childNodes = item.get_SiteMapNode().
        get_ChildNodes();
    // Only do this work if there are child nodes.
    if (childNodes != null) {
        // Add another PathSeparator after the CurrentNode.
        SiteMapNodeItem finalSeparator = new SiteMapNodeItem(item.
            get_ItemIndex(), SiteMapNodeItemType.PathSeparator);

        SiteMapNodeItemEventArgs eventArgs = new SiteMapNodeItemEventArgs(
            finalSeparator);

        InitializeItem(finalSeparator);
        // Call OnItemCreated every time a SiteMapNodeItem is
        // created and initialized.
        OnItemCreated(eventArgs);
        // The pathSeparator does not bind to any SiteMapNode, so 
        // do not call DataBind on the SiteMapNodeItem.
        item.get_Controls().Add(finalSeparator);
        // Create a DropDownList and populate it with the children of
 the 
        // CurrentNode. There are no styles or templates that are applied
        // to the DropDownList control. If OnSelectedIndexChanged is
 raised, 
        // the event handler redirects to the page selected.
        // The CurrentNode has child nodes.
        DropDownList ddList = new DropDownList();
        ddList.set_AutoPostBack(true);

        ddList.add_SelectedIndexChanged(new EventHandler(this.
            DropDownNavPathEventHandler));
        // Add a ListItem to the DropDownList for every node in the
        // SiteMapNodes collection.
        for (int iCtr = 0; iCtr < childNodes.get_Count();
 iCtr++) {
            SiteMapNode node = (SiteMapNode)childNodes.get_Item(iCtr);
            ddList.get_Items().Add(new ListItem(node.get_Title(),
 node.
                get_Url()));
        }

        item.get_Controls().Add(ddList);
    }
} //AddDropDownListAfterCurrentNode
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
      System.Web.UI.WebControls.SiteMapNodeItem
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「SiteMapNodeItem クラス」の関連用語

SiteMapNodeItem クラスのお隣キーワード
検索ランキング

   

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



SiteMapNodeItem クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS