Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a site that makes use of the asp.net menu control
ASP.NET
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" 
                IncludeStyleBlock="false" Orientation="Horizontal" SkipLinkText="" RenderingMode="List">


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.
Posted
Updated 4-Nov-11 8:40am
v2

1 solution

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(){})();";


Now a tap on the iPad/iPhone holds the menu open, and other browsers don't seem to be affected (hover still works).
 
Share this answer
 
Comments
mike6662 22-Mar-12 20:09pm    
Could you explain where menuRow is defined please ?
Georg Machacek 26-Jun-12 6:46am    
works great thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900