atamata
atamata

Reputation: 1077

Sitemapnode parent menu item not clickable

I have seen several other questions which address this but none of them address the issue I'm having.

If you remove the url property from a sitemap node it is still clickable, ie it still renders as an tag so can be clicked and fires a postback. I have done this for 'parent' sitemapnodes in my menu, and it's causing issues as I don't want postbacks to be fired when these items are clicked.

In code I have made the parent menu items 'selectable = false', and they render as a span instead of an anchor, but the styling is completely different and I can't even get to the 'child' menu items as they disappear when I try to hover over them.

Is there a way of making 'parent' sitemapnode items non-clickable, non-anchor tags so that no postback is fired if they are clicked?

My code: Web.sitemap

<siteMapNode title="Maintenance" description="Admin functions" >
    <siteMapNode url="~/UserAdmin/UserAdmin.aspx" title="Manage Users" roles="Admin" description="Manage Users" />
    <siteMapNode url="~/UserAdmin/UserDetails.aspx?mode=new" title="Create User" roles="Admin" description="Create User"/>
</siteMapNode>

c#

if (node.Title == "Maintenance")
    e.Item.Selectable = false;

I've started looking into hacking the styling on my masterpage to apply the the class which is used on the anchor tag to the span which is rendered when setting selectable=false. But I'd rather not have to.

thanks in advance

Upvotes: 0

Views: 977

Answers (1)

Ishan Garg
Ishan Garg

Reputation: 1

Remove the URL Tag in the SiteMapNode and in the Web.Config add the

SecurityTrimmingEnabled = false

It will make that menu item non clickable.

Upvotes: 0

Related Questions