Reputation: 11573
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>
Upvotes: 0
Views: 486
Reputation:
I have had a similar problem. The resolution I used depends on what control you are binding to your SiteMapDataSource:
Option A: You are using asp.net menu, set 'StaticDisplayLevels="2"` in the menu properties.
Option B: if you are using nested Repeaters, or some other control that you bind to a SiteMapDataSource, then set ShowStartingNode="false"
as the accepted answer shows and manually code the root page wherever you want it to appear in relation to the rest of your menu.
Upvotes: 0
Reputation: 4074
You probably have a SiteMap DataSource somewhere - change the "ShowStartingNode" attribute to be false.
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false"/>
Upvotes: 1
Reputation: 10645
Depending on how you're creating the menu, could you have a "dummy" root node, and your top-level items underneath this, and render the menu from these, effectively ignoring the root node?
Upvotes: 0