views:

300

answers:

1

I'm trying to make a menu based off of an asp.net sitemap. How do you nest the sitemap nodes so that they all appear on the same level. Here is what I have:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>

    <siteMapNode url="~/Default.aspx" title="Home"  description="link to Home" />
    <siteMapNode url="~/about.aspx" title="About"  description="abot" />

 </siteMapNode>

</siteMap>

Here is what the code for the Menu control looks like:

<asp:Menu ID="Menu1" runat="server" BackColor="#E3EAEB" 
        DataSourceID="SiteMapDataSource1" 
    </asp:Menu>

They both appear as 2nd tier elements underneath an arrow. Sorry for the beginner question but I've never used the menu control before.

+2  A: 

You just need to set the StaticDisplayLevels and only have one level in the sitemap file.

<asp:Menu runat="server" DataSourceID="SiteMapDataSource" StaticDisplayLevels="2" >
</asp:Menu>

An example of the web.sitemap:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode>
     <siteMapNode url="Default.aspx" title="Home"  description="" />
     <siteMapNode url="Page2.aspx" title="Page2"  description="" />
    </siteMapNode>
</siteMap>
Relster