Displaying the navigation information in a Menu : SiteMap Menu « Sitemap « ASP.Net






Displaying the navigation information in a Menu


<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Displaying the navigation information in a Menu</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:SiteMapDataSource runat="Server" ID="SiteMapDataSource1" />        
        <asp:Menu DataSourceID="SiteMapDataSource1" runat="server"
            ID="mnuNavigation">            
        </asp:Menu>    
    </div>
    </form>
</body>
</html>
File: Web.sitemap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/Default.aspx" title="Home">
    <siteMapNode url="~/Default.aspx" title="Books">
      <siteMapNode url="~/Novels.aspx" title="Novels" />
      <siteMapNode url="~/History.aspx" title="History" />
      <siteMapNode url="~/Romance.aspx" title="Romance" />
    </siteMapNode>
    <siteMapNode url="~/Default.aspx" title="Electronics">
      <siteMapNode url="~/Cameras.aspx" title="Camera" />
      <siteMapNode url="~/Computers.aspx" title="Computer" />
    </siteMapNode>
    <siteMapNode url="~/Default.aspx" title="DVDs">
      <siteMapNode url="~/Horror.aspx" title="Horror" />
      <siteMapNode url="~/Kids.aspx" title="Kids" />
    </siteMapNode>
    <siteMapNode url="~/Default.aspx" title="Computers">
      <siteMapNode url="~/Desktop.aspx" title="Desktop" />
      <siteMapNode url="~/Laptop.aspx" title="Laptop" />
    </siteMapNode>
  </siteMapNode>
</siteMap>

 








Related examples in the same category