SiteMapPath Control

The article explains how to use SiteMapPath Control. The SiteMapPath control is used for displaying paths of pages dynamically from the SiteMap file using the SiteMapDataSource control.

Add below code in the master page.

Aspx Code

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <asp:ContentPlaceHolder ID="head" runat="server">
    <form id="form1" runat="server">
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="true" />
            <asp:SiteMapPath ID="SiteMapPath1" runat="server" PathSeparator=" > " RenderCurrentNodeAsLink="false">
            <hr />
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

Add a new site map page and add the site map nodes with reference url as shown below.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="" > 
    <siteMapNode url="~/Home.aspx" title="Home" description="Home Page" >
      <siteMapNode url="~/Products.aspx" title="Products" description="Products">
        <siteMapNode url ="~/Exporting.aspx" title="Exporting" description="Exporting Product Page"></siteMapNode>
        <siteMapNode url ="~/Importing.aspx" title="Importing" description="Importing Product Page"></siteMapNode>
      <siteMapNode url="~/About Us.aspx" title="About Us" description="About Us Page" />
      <siteMapNode url="~/ContactUs.aspx" title="Contact Us" description="Contact Us Page" />

Output of SiteMapPath control


Demo Code

Download Demo