---
title: "SiteMapDataSource Control in ASP.Net"  
description: "The SiteMapDataSource control enables you to sit navigation data on your pages. The SiteMapDataSource control is used as a data source to place a site"  
author: "Pushpendra Singh"  
published: 2010-11-04  
updated: 2020-01-17  
canonical: https://www.mindstick.com/articles/192/sitemapdatasource-control-in-asp-dot-net  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 2 minutes  

---

# SiteMapDataSource Control in ASP.Net

The SiteMapDataSource control enables you to declaratively data-bind to site [navigation](https://www.mindstick.com/blog/62/different-navigation-in-asp-dot-net) data in your pages. The [SiteMapDataSource control is used](https://www.mindstick.com/Articles/841/referential-integrity-in-sharepoint-2010) as a [data source](https://www.mindstick.com/forum/160659/how-do-you-create-a-custom-filter-to-filter-any-text-in-the-data-source-in-angularjs) to place a site map on the website. A site map is a way to present all folders and pages of the website. The site map information can appear in many forms. SiteMapDataSource control is used generally as a data source for asp: SiteMapPath control.\

**Some Important [Properties](https://yourviews.mindstick.com/view/81845/now-it-s-possible-to-predict-properties-of-any-molecule) of SiteMapDataSource Control:**

| **[Sitemap](https://www.mindstick.com/blog/301744/how-important-is-a-sitemap-for-the-indexing-of-your-website) Provider** | Gets or sets the name of the site map provider. This information is written on [web.config](https://www.mindstick.com/forum/183/web-config-file) file. |
| --- | --- |
| ## StartingUrlNode | Used to set the URL in the sitemap that will be [considered as](https://www.mindstick.com/forum/156093/what-is-considered-as-more-significant-creating-content-or-building-backlinks) root. |
| ## ShowStartingNode | True/false. Whether to show [starting](https://www.mindstick.com/blog/12024/things-you-need-to-know-when-starting-your-own-business) node or not. |

**Sitemap.master**

```
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SiteMapDataSource1"></asp:Repeater>    <asp:SiteMapDataSource StartingNodeUrl="~/home.aspx" ID="SiteMapDataSource1" runat="server" /><asp:SiteMapPath ID="SiteMapPath1" runat="server"/>
```

Here StartingNodeUrl is "~/home.aspx" site map Node will be started from Home

![SiteMapDataSource Control in ASP.Net](https://www.mindstick.com/mindstickarticle/327471bb-2f13-47bf-b463-42b2dfee47d8/images/6dfe5f7c-3c6c-40b7-a73b-c3eb45a311bf.png)

**Web.sitemap**

```
<siteMap xmlns="net" >  <siteMapNode url="home.aspx"title="Home"   description="Home">   <siteMapNode url="database.aspx"title="Database"   description="Database">     <siteMapNode url="sqlserver.aspx"title="SqlServer"description="Sql"/>     <siteMapNode url="mysql.aspx"title="My Sql"   description="My Sql" />    </siteMapNode>      <siteMapNode url="script.aspx"title="Scripting Language"   description="Scripting Language" >      <siteMapNode url="javascript.aspx"title="java script"   description="Java script" />      <siteMapNode url="vbscript.aspx"title="vb script"   description="1" />      </siteMapNode> </siteMapNode></siteMap>
```

Here home.aspx is the parent node of [database](https://www.mindstick.com/articles/71/how-to-create-xml-file-of-database-in-c-sharp).aspx and script.aspx. [sqlserver](https://www.mindstick.com/forum/33788/how-to-select-comma-separated-list-in-sqlserver).aspx & mysql.aspxare child node of database.aspx. javascript.aspx and vbscript.aspx are the child node of script.aspx

**Home.aspx**

```
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/database.aspx">Database</asp:HyperLink><asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="~/script.aspx">Scripting language</asp:HyperLink>
```

When add Database.aspx Script.aspx page then select sitemap.master

**Database.aspx**

```
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/sqlserver.aspx">SqlServer</asp:HyperLink>  <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/mysql.aspx">MySql</asp:HyperLink>
```

**Script.aspx**

```
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/javascript.aspx">Java Script</asp:HyperLink><asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/vbscript.aspx">VB Script</asp:HyperLink>
```

**Run the project**

Now site map path will show on the page

![SiteMapDataSource Control in ASP.Net](https://www.mindstick.com/mindstickarticle/327471bb-2f13-47bf-b463-42b2dfee47d8/images/551d6de3-3cfc-4c38-9c4c-834442685a9b.png)

![SiteMapDataSource Control in ASP.Net](https://www.mindstick.com/mindstickarticle/327471bb-2f13-47bf-b463-42b2dfee47d8/images/228a5d4c-7410-4d3b-8f86-dedc1870c541.png)

---

Original Source: https://www.mindstick.com/articles/192/sitemapdatasource-control-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
