简体   繁体   English

Sitemapnode父菜单项不可单击

[英]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. 如果您从站点地图节点中删除url属性,则该属性仍然是可点击的,即它仍呈现为标记,因此可以单击并触发回发。 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. 我已经为菜单中的“父级” sitemapnodes完成了此操作,这会导致出现问题,因为我不希望单击这些项目时触发回发。

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. 在代码中,我将父菜单项设置为“ selectable = false”,它们以跨距而不是锚的形式呈现,但是样式完全不同,当它们消失时,我什至无法进入“子”菜单项我试图将鼠标悬停在它们上方。

Is there a way of making 'parent' sitemapnode items non-clickable, non-anchor tags so that no postback is fired if they are clicked? 有没有一种方法可以使“父级” sitemapnode项成为不可单击的,非锚定的标签,以便在单击时不会触发回发?

My code: Web.sitemap 我的代码: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# 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. 我已经开始研究如何破解我的母版上的样式,以将锚标记上使用的类应用于在设置selectable = false时呈现的跨度。 But I'd rather not have to. 但是我宁愿不必这样做。

thanks in advance 提前致谢

Remove the URL Tag in the SiteMapNode and in the Web.Config add the 删除SiteMapNodeURL标记,然后在Web.Config添加

SecurityTrimmingEnabled = false

It will make that menu item non clickable. 这将使该菜单项不可单击。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM