Site Navigation
 
Introduction to Site Navigation
 
A web site is collection of web pages. The user moves on various pages through the linked web pages to get information of own choice and to perform other tasks. Usually a developer creates a number of pages that are interconnected in some manner. It can become difficult to manage all of the links, when pages in a web site grow. An Asp.Net site solves this problem with the introduction of a navigational system that makes it easier to manage navigation between web pages.
 
In Asp.Net 2.0, navigational controls are available which allow users to easily move back and forth among the web pages. ASP.NET site navigation facilitates you to store links to all of your pages in a central location, and render those links in lists or navigation menus on each page by including a specific Web server control. The new site navigation system includes the capability to define your entire site in an XML file. So, the most common way to create a site navigation data source is to create an XML file that is called a site map.
 
The common site navigation controls available are following:
 
1. SiteMapPath Control

2. TreeView Control

3. Menu Control
 
Creating Simple Site Navigation
 
First of all create a new web site, name it and then select the Sit Map Item from Add New Item dialog box. After clicking Add, web.sitemap is added to your web site, and the structure of a site map is given to you, for example:
 
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url=" " description=" ">
<siteMapNode url=" " title=" " description=" " />
<siteMapNode url=" " title=" " description=" " />
</siteMapNode>
</siteMap>

The site map file has a single <site map > element that defines the namespace:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
 
Setting SiteMapNode Attributes
 
The sitemap element is nested with <SiteMapNode>, and then any number of child <SiteMapNode> can be nested in the first <SiteMapNode>.
 
Each siteMapNode has three attributes:
 
• URL: the URL of the page.

• Title: the string that will appear in the navigational control.

• Description: a short text that will appear as a tool tip if the navigational control supports this feature.
 
An example of a site map XML file:
 
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="www.nodes.com" title="Nodes" description="NodeSample">
<siteMapNode url="www.a_node.com" title="Node A" description="MyNode A" />
<siteMapNode url="www.b_node.com" title="Node B" description="MyNode B" />
</siteMapNode>
</siteMap>