menú horizontal que se muestra como una lista vertical

When my pages render occasionally the horizontal menu displays like that. Why?

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" 
    EnableViewState="false" IncludeStyleBlock="false" 
    Orientation="Horizontal" ClientIDMode="AutoID">

It generally does this when a page is loading a lot of data, but when the data finishes loading it never goes back to horizontal.

Testing with IE 7, 8, and 9, and Chrome.

I looked around the internet and found some people saying it was the z-index but adjusting didn't help.

I'm using "developer tools" in IE8 to troubleshoot further and found some javascript calls that didn't succeed. I have no idea what they mean.

<script type="text/javascript">
Sys.WebForms.PageRequestManager._initialize('ctl00$MainContent$tsmgrEmployees', 'aspnetForm', ['tctl00$MainContent$uPanelEmployees',''], ['ctl00$MainContent$btnClear','','ctl00$MainContent$txtEUID','','ctl00$MainContent$txtFirstName','','ctl00$MainContent$txtLastName',''], [], 90, 'ctl00');

Error produced

'Sys.WebForms.PageRequestManager' es nulo o no es un objeto

<script type='text/javascript'>new Sys.WebForms.Menu({ element: 'ctl00_NavigationMenu', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false });</script>

Error produced

'Sys.Webforms.Menu' is null or not an object

I believe that the remaining errors are all cascades from these two. Do you think I should replace the jscript libraries with updated ones? Could it possibly be browser related since I'm using IE8 (not in compatibility mode).

Another odd bit of information that might help is, when I build the solution in Visual Studio 2010 on WinXP Pro on my development environment it works fine, but when I publish it to the server (IIS 7.5, Server 2008 R2) it breaks. At first I thought it might be data lag, but the connection string on the server should be faster than the connection string on my dev environment. Server uses Localhost as the target, my dev workstation uses the server path... so I don't think its the data lag.

preguntado el 01 de febrero de 12 a las 22:02

3 Respuestas

I had this same problem. I solved it by making the RenderingMode="Table" under the asp:Menu control.


<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal" RenderingMode="Table">
        <StaticMenuItemStyle CssClass="menuitem" />
        <DynamicMenuItemStyle CssClass="menuitem" />

You will have to fiddle a little more with css (deleting the 'ul' and 'li' attributes in your css).

La creación de

 <StaticMenuItemStyle CssClass="menuitem" />
 <DynamicMenuItemStyle CssClass="menuitem" />

In menu control (as shown above) also helps with css formatting.

For some reason the menu list is creating this problem. This is at least a workaround.

Respondido 23 Jul 12, 07:07

Solved it for me too. Thanks! - smoore4

I know this is an old question, and hope that this comment/question will still be seen and replied to. Rendering as Table (though most recommend against this) DOES solve the problem, but my beautiful menu buttons are turned in to ugly hyperlinks. I lose all my formatting. I've been tweaking the CSS to try to resolve this. How do I take my menu ul li formatting and apply it here when I use RenderingMode="Table" ?? I have been googling for a CSS formatting tutorial or example and finding none. - DJGray

I had the same problem. It turned out to be caused by the following line in my Global.asax file:

RouteTable.Routes.MapPageRoute("", "{*dummy}", "~/Default.aspx")

I wanted to send users requesting non-existing routes to the Default.aspx page. Apparently this has the unwanted side-effect that the browser can't find the JS-file needed to render the menu horizontally.

Respondido 22 ago 12, 17:08

As of Visual Studio 2010 / .NET 4.0, ASP:Menus render as bulleted lists (ul) más bien que tables. You must have CSS that affects uls that is overriding the expected design of the menu.

Respondido 02 Feb 12, 02:02

Note that I assumed you are using .NET 4.0 based on tags in your previous questions. - Devin Burke

You are correct, .net 4. I'm looking through the CSS now. Thanks - Lucrecio

I updated my original post with some additional details about the errors. I just found these using Developer Tools in IE 8. - Lucrecio

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.