Export (0) Print
Expand All
Expand Minimize

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)

public enum SiteMapNodeItemType

Member nameDescription
RootThe top node of the site navigation hierarchy. There can be only one root node.
ParentA 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.
CurrentThe currently viewed page in the site navigation path.
PathSeparatorA site map navigation path separator. The default separator for the SiteMapPath control is the ">" character.

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.

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 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);
    }
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), 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.

Community Additions

ADD
Show:
© 2014 Microsoft