SiteMapNodeItemType Enumeração

Definição

A enumeração SiteMapNodeItemType é usada pelo controle SiteMapPath para identificar o tipo de um nó SiteMapNodeItem dentro de uma hierarquia de nó.

public enum class SiteMapNodeItemType
public enum SiteMapNodeItemType
type SiteMapNodeItemType = 
Public Enum SiteMapNodeItemType
Herança
SiteMapNodeItemType

Campos

Current 2

A página exibida atualmente no caminho de navegação do site.

Parent 1

Um nó pai da página exibida atualmente no caminho de navegação do site. Um nó pai é qualquer nó que é encontrado entre o nó raiz e o nó atual na hierarquia de navegação.

PathSeparator 3

Um separador de caminho de navegação de mapa de site. O separador padrão para o controle SiteMapPath é o caractere ">".

Root 0

O nó superior da hierarquia de navegação no site. Pode haver apenas um nó raiz.

Exemplos

O exemplo a seguir demonstra como chamar o SiteMapPath.OnItemCreated método depois de criar um SiteMapNodeItem dentro do SiteMapPath.InitializeItem método. Este exemplo faz parte de um exemplo maior fornecido para a SiteMapPath classe.

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

Comentários

O SiteMapPath controle gerencia suas informações de navegação do site como uma coleção de SiteMapNodeItem objetos. SiteMapNodeItem os objetos representam tipos funcionalmente diferentes de SiteMapNode nós. Assim, eles são gerenciados pelo SiteMapPath controle. A lista a seguir descreve os tipos de nós disponíveis:

  • Um nó que representa a página exibida no momento.

  • Um nó que é o nó superior da hierarquia de navegação do site.

  • Zero ou mais nós entre o nó superior e o nó atual (nós pai).

  • Zero ou mais nós que representam separadores de caminho de navegação do site.

Cada nó é associado a dados a um subjacente SiteMapNode, exceto nós do tipo PathSeparator.

Aplica-se a

Confira também