SiteMapNodeItemType Enumeración

Definición

El control SiteMapNodeItemType utiliza la enumeración SiteMapPath para identificar el tipo de un nodo SiteMapNodeItem dentro de una jerarquía de nodos.

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

Campos

Current 2

Página de la ruta de navegación del sitio que se está viendo en la actualidad.

Parent 1

Nodo primario de la página que se está viendo en la actualidad en la ruta de navegación del sitio. Un nodo primario es cualquier nodo que se encuentre entre el nodo raíz y el nodo actual en la jerarquía de navegación.

PathSeparator 3

Separador de la ruta de navegación del mapa del sitio. El separador predeterminado del control SiteMapPath es el carácter ">".

Root 0

Nodo superior de la jerarquía de navegación del sitio. Sólo puede haber un nodo raíz.

Ejemplos

En el ejemplo siguiente se muestra cómo llamar al SiteMapPath.OnItemCreated método después de crear un SiteMapNodeItem elemento dentro del SiteMapPath.InitializeItem método . Este ejemplo forma parte de un ejemplo más grande proporcionado para la SiteMapPath clase .

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

Comentarios

El SiteMapPath control administra su información de navegación del sitio como una colección de SiteMapNodeItem objetos . SiteMapNodeItem Los objetos representan tipos funcionalmente diferentes de SiteMapNode nodos. En consecuencia, son administrados por el SiteMapPath control. En la lista siguiente se describen los tipos de nodos disponibles:

  • Un nodo que representa la página que se ve actualmente.

  • Un nodo que es el nodo superior de la jerarquía de navegación del sitio.

  • Cero o más nodos entre el nodo superior y el nodo actual (nodos primarios).

  • Cero o más nodos que representan separadores de ruta de navegación del sitio.

Cada nodo está enlazado a datos a un subyacente SiteMapNode, excepto los nodos del tipo PathSeparator.

Se aplica a

Consulte también