.NET Framework Class Library SiteMapNodeItemType Enumeration The SiteMapNodeItemType enumeration is used by the SiteMapPath control to identify the type of a SiteMapNodeItem node within a node hierarchy.
Namespace:
System.Web.UI.WebControls
Assembly:
System.Web (in System.Web.dll)

Syntax
Public Enumeration SiteMapNodeItemType
public enum SiteMapNodeItemType
public enum class SiteMapNodeItemType

Members
| Member name | Description |
|---|
| Root | The top node of the site navigation hierarchy. There can be only one root node. | | Parent | A parent node of the currently viewed page in the site navigation path. A parent node is any node that is found between the root node and the current node in the navigation hierarchy. | | Current | The currently viewed page in the site navigation path. | | PathSeparator | A site map navigation path separator. The default separator for the SiteMapPath control is the ">" character. |

Remarks
The SiteMapPath control manages its site navigation information as a collection of SiteMapNodeItem objects. SiteMapNodeItem objects represent functionally different types of SiteMapNode nodes. Accordingly, they are managed by the SiteMapPath control. The following list describes the types of nodes available: One node that represent the currently viewed page. One node that is the top node of the site navigation hierarchy. Zero or more nodes between the top node and the current node (parent nodes). Zero or more nodes that represent site navigation path separators.
Each node is data-bound to an underlying SiteMapNode, except nodes of the PathSeparator type.

Examples
The following code example demonstrates how to call the OnItemCreated method after creating a SiteMapNodeItem within the InitializeItem method. This code example is part of a larger code example provided for the SiteMapPath class.
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 'AddDropDownListAfterCurrentNode
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);
}
}

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
Bibliothèque de classes .NET Framework SiteMapNodeItemType, énumération L'énumération SiteMapNodeItemType est utilisée par le contrôle SiteMapPath pour identifier le type d'un nœud SiteMapNodeItem dans une hiérarchie de nœuds.
Espace de noms :
System.Web.UI.WebControls
Assembly :
System.Web (dans System.Web.dll)

Syntaxe
Public Enumeration SiteMapNodeItemType
public enum SiteMapNodeItemType
public enum class SiteMapNodeItemType

Membres
| Nom de membre | Description |
|---|
| Root | Nœud supérieur dans la hiérarchie de navigation de site. Il ne peut y avoir qu'un seul nœud racine. | | Parent | Nœud parent de la page actuellement affichée dans le chemin de navigation de site. Un nœud parent correspond à tout nœud situé entre le nœud racine et le nœud actuel dans la hiérarchie de navigation. | | Current | Page actuellement affichée dans le chemin de navigation de site. | | PathSeparator | Séparateur de chemin pour la navigation de plan de site. Le séparateur par défaut pour le contrôle SiteMapPath est le caractère « > ». |

Notes
Le contrôle SiteMapPath gère ses informations sur la navigation du site comme une collection d'objets SiteMapNodeItem. Les objets SiteMapNodeItem représentent, d'un point de vue fonctionnel, différents types de nœuds SiteMapNode. En conséquence, ils sont gérés par le contrôle SiteMapPath. La liste suivante décrit les types de nœuds disponibles : Un nœud qui représente la page actuellement affichée. Un nœud qui correspond au nœud supérieur dans la hiérarchie de navigation de site. Zéro ou plusieurs nœuds entre le nœud supérieur et le nœud actuel (nœuds parents). Zéro ou plusieurs nœuds qui représentent des séparateurs de chemin pour la navigation de site.
Chaque nœud est lié aux données d'un nœud SiteMapNodesous-jacent, sauf les nœuds du type PathSeparator.

Exemples
L'exemple de code suivant montre comment appeler la méthode OnItemCreated après avoir créé un SiteMapNodeItem dans la méthode InitializeItem. Cet exemple de code fait partie d'un exemple plus complet fourni pour la classe SiteMapPath.
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 'AddDropDownListAfterCurrentNode
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);
}
}

Informations de version
.NET FrameworkPris en charge dans : 4, 3.5, 3.0, 2.0

Plateformes
Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2
Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Voir aussi
RéférenceAutres ressources
|