Search code examples
asp.nethtmlaspmenu

horizontal asp.net menu displaying as a vertical list


http://i44.tinypic.com/5ureav.png

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">
    <Items></Items>
</asp:Menu>

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">
//<![CDATA[
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');
//]]>
</script>

Error produced

'Sys.WebForms.PageRequestManager' is null or not an object

<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.


Solution

  • 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.