views:

490

answers:

2

I have a web.sitemap like this:

<siteMapNode url="~/Default.aspx" title="Home" description="" >
    <siteMapNode title="Node 1" description="">
        <siteMapNode url="" title="Node 1-1" description="" />
        <siteMapNode url="" title="Node 1-2" description="" />
    </siteMapNode>
    <siteMapNode title="Node 2" description="">
        <siteMapNode url="" title="Node 2-1" description="" />
        <siteMapNode url="" title="Node 2-2" description="" />
    </siteMapNode>
</siteMapNode>

If I use an ASP.NET menu control (with StaticDisplayLevels=2), I get this:

| Home | Node 1 | Node 2 |

Is there a property for skipping "Home" and get this menu (from that sitemap):

| Node 1 | Node 2 |

?

+1  A: 

If you aren't already using a SiteMapDataSource to populate the Menu, you can do that and set its ShowStartingNode property to false (and, as noted in the comment above, decrement the StaticDisplayLevels by 1, since you're removing a level) like this:

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

Of course, this only works for the root node. To skip other nodes or entire levels of nodes, it would be necessary to massage the source Xml before populating the Menu (for example, use some xslt to strip out a class of nodes).

Jeff Sternal
+4  A: 

If you are using a SiteMapsDataSource you can skip the root node by setting the ShowStartingNode property to false.

Andy Rose
Great, thanks. The property is in the DataSource, not the menu control where I was looking
Juan Manuel
I also had to switch StaticDisplayLevels from 2 to 1, since the starting node is not showing now
Juan Manuel