在母版页上使用时,ASP.Net菜单控件呈现不正确

编程入门 行业动态 更新时间:2024-10-25 20:20:40
本文介绍了在母版页上使用时,ASP.Net菜单控件呈现不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当与母版页一起使用时,我正在努力寻找针对ASP.Net菜单控件的怪异问题的解决方案.

I'm struggling to find a solution for a weird issue with ASP.Net Menu control, when used in conjunction with Master Pages.

当用户导航到页面时-通过.菜单-从母版页继承,整个菜单会展开并在屏幕上闪烁.立即折叠并呈现页面. 在屏幕上引起一些闪烁,使用户感到烦恼.

When the user navigates to a page - via. the menu - which inherits from the Master Page, the entire menu just expands and flashes across the screen. Collapses immediately and the page is rendered.... Causes some flickering on the screen, annoying for the users.

现在,为此提出了一些解决方法: -从web.config中注释掉标签. -在其Page_Load事件中为母版页提供ID. 都试过了,似乎并没有解决我的问题:(. 我会考虑的.

Now, there are a few work-arounds suggested for this: - Commenting out the tag from the web.config. - giving IDs to the Master Pages in their Page_Load events. Tried'em all, dosen't seem to sort out my issue :(. I'd take any ideas.

-香港

推荐答案

我记得在我的某个地点看到过这一点.从那以后,我将菜单翻录了下来,但是将其放回到我的母版页中,我再也看不到闪烁了.这是一个简单菜单的代码,该菜单在母版页中不会闪烁;

I remember seeing that at one point in a site of mine. Since then I ripped the menu out, but putting it back into my master page I don't see the flicker any more. Here's the code for a simple menu that works without flicker in a master page;

<asp:Menu ID="menu" DataSourceID="sitemap" runat="server" /> <asp:SiteMapDataSource ID="sitemap" ShowStartingNode="false" runat="server" />

我自己没有尝试过,但是如何将菜单子级的默认类设置为不可见(例如,invisibleMenu类),这意味着它最初是不可见的加载,然后使用一些JavaScript来删除不可见性?在jQuery中,类似

Not tried it myself, but how about setting the default class for the menu children to invisible (say, a class of invisibleMenu), which means it initially loads invisibly, and then using a bit of javascript to remove the invisibility? In jQuery, something like

$('.invisibleMenu').removeClass('invisibleMenu');

更多推荐

在母版页上使用时,ASP.Net菜单控件呈现不正确

本文发布于:2023-11-12 09:40:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581143.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不正确   控件   菜单   母版   Net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!