This documentation is archived and is not being maintained.

SiteMapPath.NodeStyle Property

Gets the style used for the display text for all nodes in the site navigation path.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public Style NodeStyle { get; }

Property Value

Type: System.Web.UI.WebControls.Style
The Style that contains the style settings for the display text in the SiteMapPath control.

Use the NodeStyle property to control the appearance of the display text for all navigation path nodes rendered by the control. By default, the display text is that specified in the Title property of the SiteMapNode that represents the page. Common style settings include custom background color, foreground color, font properties, and node spacing.

For SiteMapPath nodes, style properties are merged into a single style, in the following order:

  1. NodeStyle

  2. CurrentNodeStyle or RootNodeStyle, depending on the node type.


If you set the node font style to a strikeout or overline style, the default underline style of the node is not displayed unless it is explicitly set to true.

If the NodeStyle is defined, it is initially applied to each node. If an additional style is defined for a particular type of node, such as the root node or current node, this style supersedes the general style specified in the NodeStyle property. If a template is defined for a particular type of node, it supersedes all defined styles for that node.

The following code example demonstrates how to define a NodeStyle that is merged with a RootNodeStyle to demonstrate the order of style precedence for the SiteMapPath nodes.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">

<html xmlns="" >
    <head runat="server">
    <title>ASP.NET Example</title>
        <form id="form1" runat="server">

            <!-- The following example demonstrates some of the orders
                 of precedence when applying styles and templates to
                 functional nodes of a SiteMapPath.

                 The NodeStyle and RootNodeStyle define the same attributes,
                 but are different and conflict with each other: the
                 RootNodeStyle supersedes NodeStyle, and is the style
                 rendered. Notice, however, that the underline style
                 defined by NodeStyle is still applied.

                 Both a CurrentNodeStyle and a CurrentNodeTemplate are
                 defined. A template supersedes a style for a node
                 type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
                 is ignored. -->

            <asp:SiteMapPath ID="SiteMapPath1" runat="server"
                NodeStyle-Font-Names="Franklin Gothic Medium"
                        <asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>


.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.