SiteMapNodeItemType 列挙型

定義

SiteMapNodeItemType 列挙体は、ノード階層内の SiteMapPath ノードの種類を識別するために、SiteMapNodeItem コントロールによって使用されます。

public enum class SiteMapNodeItemType
public enum SiteMapNodeItemType
type SiteMapNodeItemType = 
Public Enum SiteMapNodeItemType
継承
SiteMapNodeItemType

フィールド

Current 2

サイト ナビゲーション パスの現在表示されているページ。

Parent 1

サイト ナビゲーション パスの現在表示されているページの親ノード。 親ノードとは、ナビゲーション階層内でルート ノードと現在のノードの間に存在するノードです。

PathSeparator 3

サイト マップ ナビゲーション パスの区切り記号。 SiteMapPath コントロールの既定の区切り記号は、">" 文字です。

Root 0

サイト ナビゲーション階層の一番上のノード。 ルート ノードは 1 つしか存在しません。

次の例では、メソッド内を作成した後に SiteMapPath.OnItemCreated メソッドを SiteMapNodeItem 呼び出す方法を SiteMapPath.InitializeItem 示します。 この例は、クラスに提供されるより大きな例の SiteMapPath 一部です。

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 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

注釈

コントロールは SiteMapPath 、そのサイト ナビゲーション情報をオブジェクトの SiteMapNodeItem コレクションとして管理します。 SiteMapNodeItem オブジェクトは機能的に異なる種類のノードを SiteMapNode 表します。 したがって、コントロールによって SiteMapPath 管理されます。 次の一覧では、使用可能なノードの種類について説明します。

  • 現在表示されているページを表す 1 つのノード。

  • サイト ナビゲーション階層の最上位ノードである 1 つのノード。

  • 最上位ノードと現在のノード (親ノード) の間の 0 個以上のノード。

  • サイト ナビゲーション パスの区切り記号を表す 0 個以上のノード。

各ノードは、PathSeparator 型のノードを除き、基になる SiteMapNodeノードにデータバインドされます。

適用対象

こちらもご覧ください