ASP.NET 菜单中缺少没有 URL 的节点的弹出类
我遇到了一个小问题,当站点地图节点没有 URL 时,ASP 菜单控件中的弹出图标不会出现。以以下站点地图节点为例:
<siteMapNode title="Top 1" url="~/Top1.aspx">
<siteMapNode title="Sub 1" url="~/Sub1.aspx" />
</siteMapNode>
<siteMapNode title="Top 2">
<siteMapNode title="Sub 2" url="~/Sub2.aspx" />
</siteMapNode>
第一个顶级项目 – Top 1 – 将弹出 CSS 类写入跨越标签的标签。然而,第二个顶级项目——Top 2——没有获得该类别。鉴于此类通常用于容纳箭头,指示该项目下方有更多内容,因此这里存在一些可用性问题。
有人有解决方法吗?或者,没有 URL 属性的站点地图节点是否会以某种方式破坏控件的预期用途?
编辑:此问题已在 .NET 4.5 中修复: https://connect.microsoft.com/VisualStudio/feedback/details/600069/sitemap-menu-nodes-without-a- url-不显示-popout-image-when-child-nodes-exist
I’m having a little problem with the popout icon in the ASP menu control not appearing when the sitemap node doesn’t have a URL. Take the following sitemap nodes as an example:
<siteMapNode title="Top 1" url="~/Top1.aspx">
<siteMapNode title="Sub 1" url="~/Sub1.aspx" />
</siteMapNode>
<siteMapNode title="Top 2">
<siteMapNode title="Sub 2" url="~/Sub2.aspx" />
</siteMapNode>
The first top level item – Top 1 – gets a popout CSS class written to the tag that spans the label. However the second top level item – Top 2 – does not get the class. Given this class is generally used to hold the arrow indicating there’s more content beneath the item there’s a bit of a usability problem here.
Does anyone have a workaround for this? Or alternatively, is a sitemap node without a URL attribute somehow breaking the intended usage of the control?
Edit: This issue has been fixed in .NET 4.5: https://connect.microsoft.com/VisualStudio/feedback/details/600069/sitemap-menu-nodes-without-a-url-dont-display-a-popout-image-when-child-nodes-exist
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
因此,这种行为似乎只发生在 ASP.NET4 中,并且在以前的版本中一切正常。我将此称为较新的控件渲染模式中的错误。更多信息请参见:http://www. troyhunt.com/2010/09/net4-web-apps-and-mysteriously-absent.html
So it appears this behaviour is only occurring in ASP.NET4 and was all good in previous versions. I'm calling this one as a bug in the newer control rendering mode. More info here: http://www.troyhunt.com/2010/09/net4-web-apps-and-mysteriously-absent.html
因此,在寻找此问题的解决方案很长时间后,我偶然发现了使用 jquery 的建议。效果很好!只需导入 jquery 并将以下内容放入 head 标签中即可。它将把这些三角形(或您正在使用的任何东西)添加回其下有链接的节点。希望有帮助!
So, after looking for the fix to this for a long time I stumbled across a suggestion to use jquery. It works great! Just import jquery and put the following in your head tag. It will add those triangles (or whatever you are using) back to the nodes that have links under them. Hope it helps!
尝试将 url 属性设置为#:
错误的可能原因是没有 url 字段,该节点不是链接,并且 CSS 设置为应用于链接。
Try setting the url property to #:
Probable cause of error is that without url field, the node is not link, and CSS is set to apply on links.