Bahasa

SiteMapNodeItemType Enum

Definisi

Enumerasi SiteMapNodeItemType digunakan oleh kontrol SiteMapPath untuk mengidentifikasi jenis simpul SiteMapNodeItem dalam hierarki simpul.

public enum class SiteMapNodeItemType
public enum SiteMapNodeItemType
type SiteMapNodeItemType = 
Public Enum SiteMapNodeItemType
Warisan
SiteMapNodeItemType

Bidang

Nama Nilai Deskripsi
Root 0

Simpul atas hierarki navigasi situs. Hanya ada satu simpul akar.

Parent 1

Simpul induk dari halaman yang saat ini ditampilkan di jalur navigasi situs. Simpul induk adalah simpul apa pun yang ditemukan antara simpul akar dan simpul saat ini dalam hierarki navigasi.

Current 2

Halaman yang saat ini ditampilkan di jalur navigasi situs.

PathSeparator 3

Pemisah jalur navigasi peta situs. Pemisah default untuk SiteMapPath kontrol adalah karakter "">.

Contoh

Contoh berikut menunjukkan cara memanggil SiteMapPath.OnItemCreated metode setelah membuat SiteMapNodeItem dalam SiteMapPath.InitializeItem metode . Contoh ini adalah bagian dari contoh yang lebih besar yang disediakan untuk SiteMapPath kelas .

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

Keterangan

Kontrol SiteMapPath mengelola informasi navigasi situsnya sebagai kumpulan SiteMapNodeItem objek. SiteMapNodeItem objek mewakili jenis SiteMapNode node yang berbeda secara fungsional. Dengan demikian, mereka dikelola oleh SiteMapPath kontrol. Daftar berikut ini menjelaskan jenis simpul yang tersedia:

  • Satu simpul yang mewakili halaman yang saat ini dilihat.

  • Satu simpul yang merupakan simpul teratas hierarki navigasi situs.

  • Nol atau lebih simpul antara simpul atas dan simpul saat ini (node induk).

  • Nol atau lebih simpul yang mewakili pemisah jalur navigasi situs.

Setiap simpul terikat data ke SiteMapNode, kecuali node dari jenis PathSeparator.

Berlaku untuk

Lihat juga