Question

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 |

?

Was it helpful?

Solution

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

OTHER TIPS

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top