SiteMapPath.CurrentNodeStyle Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the style used for the display text for the current node.

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

[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
public Style CurrentNodeStyle { get; }

Property Value

Type: System.Web.UI.WebControls.Style

The Style that contains the style settings for the display text for the current node of the SiteMapPath control.

Use the CurrentNodeStyle property to control the appearance of the display text for the navigation path node that represents the currently displayed page. 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, if the currently displayed page is the root node, RootNodeStyle.

System_CAPS_noteNote

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 a CurrentNodeTemplate property is defined, the CurrentNodeStyle property is ignored.

The following code example demonstrates how to declaratively set the CurrentNodeStyle of a SiteMapPath control in a Web Forms page.

<%@ Page language="c#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">

      <p><asp:SiteMapPath runat="server" ID="SiteMapPath1"
            RootNodeStyle-Font-Bold="true"
            RootNodeStyle-Font-Names="Arial Black"
            RootNodeStyle-Font-Italic="True"
            RootNodeStyle-ForeColor="Green"
            CurrentNodeStyle-ForeColor="Orange"/></p>

      <p><asp:Label
            id="Label1"
            runat="server"
            Width="441px"
            Height="64px"
            AssociatedControlID="TextBox1">
                Enter your customer service issue in the space
                provided below, and we will get back to you as
                soon as possible.</asp:Label></p>

      <p><asp:TextBox id="TextBox1" runat="server"
          Width="448px" Height="96px"></asp:TextBox></p>

      <p><asp:Button id="Button1" runat="server"
          Width="112px" Text="Submit"></asp:Button></p>
    </form>
  </body>
</html>

.NET Framework
Available since 2.0
Return to top
Show: