SiteMapNodeItemType Enumeración

Definición

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

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

Campos

Nombre Valor Description
Root 0

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

Parent 1

Nodo primario de la página que se ve actualmente 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.

Current 2

Página que se ve actualmente en la ruta de navegación del sitio.

PathSeparator 3

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

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 funcionalmente diferentes tipos 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