SiteMapNodeItemType Enumeration

Definition

Die SiteMapNodeItemType-Enumeration wird vom SiteMapPath-Steuerelement zum Bestimmen des Typs eines SiteMapNodeItem-Knotens in einer Knotenhierarchie verwendet wird.

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

Felder

Current 2

Die gerade angezeigte Seite im Sitenavigationspfad.

Parent 1

Ein übergeordneter Knoten der gerade angezeigten Seite im Sitenavigationspfad. Ein übergeordneter Knoten ist ein beliebiger Knoten, der zwischen dem Stammknoten und dem aktuellen Knoten in der Navigationshierarchie gefunden wird.

PathSeparator 3

Ein Trennzeichen für einen Sitemapnavigationspfad. Das Standardtrennzeichen für das SiteMapPath-Steuerelement ist das Zeichen „>“.

Root 0

Der oberste Knoten der Sitenavigationshierarchie. Es kann nur einen Stammknoten geben.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie Sie die SiteMapPath.OnItemCreated Methode nach dem Erstellen einer SiteMapPath.InitializeItem SiteMapNodeItem Methode aufrufen. Dieses Beispiel ist Teil eines größeren Beispiels, das für die SiteMapPath Klasse bereitgestellt wird.

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

Hinweise

Das SiteMapPath Steuerelement verwaltet seine Websitenavigationsinformationen als Sammlung von SiteMapNodeItem Objekten. SiteMapNodeItem Objekte stellen funktionsbezogene Typen von SiteMapNode Knoten dar. Dementsprechend werden sie vom SiteMapPath Steuerelement verwaltet. In der folgenden Liste werden die Typen der verfügbaren Knoten beschrieben:

  • Ein Knoten, der die aktuell angezeigte Seite darstellt.

  • Ein Knoten, der der oberste Knoten der Websitenavigationshierarchie ist.

  • Null oder mehr Knoten zwischen dem oberen Knoten und dem aktuellen Knoten (übergeordnete Knoten).

  • Null oder mehr Knoten, die Standortnavigationspfadtrennzeichen darstellen.

Jeder Knoten ist an einen zugrunde liegenden SiteMapNodeKnoten gebunden, außer Knoten des PathSeparator-Typs.

Gilt für

Siehe auch