Search code examples
asp.netweb.sitemap

Is it possible to have more than on item in ASP.NET web.sitemap?


I have an ASP.NET Menu control that works based on a Web.Sitemap. Web.Sitemap does not allow me to have more than one item in its root. But I need my menu show more than one item in its root. Is it possible?

My sitemap is like:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="" title="Menu"  description="">
    <siteMapNode url="~/Default.aspx" title="Public"  description=""/>
    <siteMapNode url="" title="Administration"  description="">
      <siteMapNode url="~/GeneralSettings.aspx" title="GeneralSettings"  description=""/>
      <siteMapNode url="~/LookupManagement.aspx" title="Lookup"  description=""/>
      <siteMapNode url="~/Administration.aspx" title="Database"  description=""/>
    </siteMapNode>
    <siteMapNode url="~/AboutUs.aspx" title="Contact us"  description="" />
  </siteMapNode>
</siteMap>

Solution

  • You probably have a SiteMap DataSource somewhere - change the "ShowStartingNode" attribute to be false.

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false"/>