the ASP.net 2.0 has built-in navigation controls. Website Navigation
It can be difficult and time-consuming to maintain navigation menus for large sites.
In asp.net 2.0, menus can be stored in a file, which is easier to maintain. This file is usually named Web.sitemap and is stored in the root directory of the Web site.
In addition, ASP.net 2.0 has three new navigation controls: Dynamic menus treeviews Site Map Path Sitemap file
This tutorial uses the following sitemap file (site map):
<?xml version= "1.0" encoding= "iso-8859-1"?>
<siteMap>
<sitemapnode title= "Home" url= " Aspnet/w3home.aspx ">
<sitemapnode title=" Services "url="/aspnet/w3services.aspx ">
< SiteMapNode title= "Training" url= "/aspnet/w3training.aspx"/> <sitemapnode title= "Support" url= "/aspnet/"
W3support.aspx "/>
</siteMapNode>
</siteMapNode>
</siteMap>
to create a sitemap file rule:The XML file must contain a <siteMap> tag <siteMap> tag around the content can only have one <siteMapNode> child node ("Home" page) each <siteMapNode> can have multiple child nodes (Web pages) each <siteMapNode> have properties that define page titles and URLs
Note: The sitemap file must reside in the root directory of the site, and the URL attribute must be relative to the root directory. Dynamic Menu
<asp:Menu> controls can display the standard site navigation menu. Code instance:
<asp:sitemapdatasource id= "NAV1" runat= "server"/> <form
"Server" >
runat= <asp:menu " Server "datasourceid=" Nav1 "/>
</form>
The <asp:Menu> control in the above example is a placeholder for the server to create a navigation menu.
The data source for the control is defined by the DataSourceId property. Id= "Nav1″ connect it to the <asp:SiteMapDataSource> control.
The <asp:SiteMapDataSource> control automatically connects to the default sitemap file (Web.sitemap).
TreeView
<asp:TreeView> controls can display multilevel navigation menus.
This menu looks like a tree with foliage, which can be turned on or off by a + or-symbol. Code instance:
<asp:sitemapdatasource id= "NAV1" runat= "server"/> <form
"Server" >
runat= <asp:treeview = "Server" datasourceid= "Nav1"/>
</form>
The <asp:TreeView> control in the example above is a placeholder for the server to create a navigation menu.
The data source for the control is defined by the DataSourceId property. Id= "Nav1″ connect it to the <asp:SiteMapDataSource> control.
The <asp:SiteMapDataSource> control automatically connects to the default sitemap file (Web.sitemap). SiteMapPath
The SiteMapPath control displays a pointer to the current page (the navigation path). The path is displayed as a clickable link to the superior page.
Unlike the TreeView and Menu controls, the SiteMapPath control does not use SiteMapDataSource. The SiteMapPath control uses the Web.sitemap file by default.
Tip: If SiteMapPath is not displayed correctly, it is most likely due to a URL error in the Web.sitemap file. Code instance:
<form runat= "Server" >
<asp:sitemappath runat= "Server"/>
</form>
The <asp:SiteMapPath> control in the example above is a placeholder for the server to create a navigation menu.