asp.net 4.0菜单控件和iPad

asp.net 4.0菜单控件和iPad

问题描述:

我有一个使用asp.net菜单控件的网站

I have a site that makes use of the asp.net menu control

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" 

                IncludeStyleBlock="false" Orientation="Horizontal" SkipLinkText="" RenderingMode="List">



除了在iPad和iPhone上,它都可以正常工作.升级到iOS5后,出现了一种新的行为:点击顶层菜单会下拉菜单项列表,但是现在并没有保持打开状态,而是立即关闭了该列表.

有趣的是,在升级之前,只要轻按列表中的一个菜单项,该列表就可以保持打开和关闭状态.



Which works fine except on iPad and iPhone. After upgrading to iOS5, a new behavior emerged: tapping on the top level menu drops down the list of menu items, but instead of staying open, the list now immediately closes.

Interestingly enough, prior to upgrading, the list would simply stay open and close when one tapped a menu item from the list.

Any help overcoming this would be appreciated.

好吧,不确定这是否是正确"的方法,但是我发现这似乎是可行的解决.

由于菜单类别是在后台代码中创建的,因此我向Navigation url属性添加了一个null函数:

Well, not sure if this is the "right" way to do it, but I found what appears to be a working fix.

Since the menu categories are created in code-behind, I added a null function to the navigate url property:

MenuItem Category = new MenuItem();
Category.Text = menuRow["Category"].ToString().Trim();
Category.Value = menuRow["Category"].ToString().Trim();
Category.NavigateUrl = "javascript:(function(){})();";



现在,在iPad/iPhone上轻按一下,菜单将保持打开状态,而其他浏览器似乎没有受到影响(悬停仍然有效).



Now a tap on the iPad/iPhone holds the menu open, and other browsers don''t seem to be affected (hover still works).