SiteMapPath RenderCurrentNodeAsLink property in asp.net

SiteMapPath RenderCurrentNodeAsLink property
SiteMapPath is an asp.net web server control. sitemappath control's RenderCurrentNodeAsLink property indicate whether the site navigation node that represents the currently displayed page is rendered as hyperlink. this property value data type is System.Boolean.

if we set the RenderCurrentNodeAsLink property value to 'true' then current page node will render as hyperlink in sitemappath control. otherwise it will display as static text. the default value of this property is false. this property allow us to create a hyperlink for current page node in sitemappath.

the following asp.net c# example code demonstrate us how can we render current page node as hyperlink in sitemappath in an asp.net application.
ButtonExample.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        SiteMapPath1.RenderCurrentNodeAsLink = true;
    }
    protected void Button2_Click(object sender, System.EventArgs e)
    {
        SiteMapPath1.RenderCurrentNodeAsLink = false;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to use SiteMapPath RenderCurrentNodeAsLink property</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">SiteMapPath Example: RenderCurrentNodeAsLink</h2>
        <asp:SiteMapPath 
             ID="SiteMapPath1" 
             runat="server"
             ForeColor="SaddleBrown"
             Font-Size="Large"
             Font-Bold="true"
             BackColor="Snow"
             >
             <NodeStyle ForeColor="SaddleBrown" />
        </asp:SiteMapPath>
        <br /><br /><br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server"
             ForeColor="SaddleBrown"
             Text="RenderCurrentNodeAsLink True"
             Height="45"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
        <asp:Button 
             ID="Button2" 
             runat="server"
             ForeColor="SaddleBrown"
             Text="RenderCurrentNodeAsLink False"
             Height="45"
             OnClick="Button2_Click"
             Font-Bold="true"
             />
    </div>
    </form>
</body>
</html>
Web.sitemap
Web.sitemap source code here.

   








Related asp.net examples