views:

138

answers:

2

Hi, I'm developing using the new ASP.NET 4 and I ran into the following issue. When I put a Menu control into the web form, the menu causes the following code to generate just before the closing tag:

<script type='text/javascript'>new Sys.WebForms.Menu({ element: 'NavigationMenu', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false }); As long as I don't use URL Rewriting, the page compiles and loads properly. But when I try to use URL Rewriting on the website, VS starts to throw "Sys is undefined" exception.

However, this does not happen always. Most frequently it happens when I change somenting positioning-related in the CSS file, but sometimes the exceptions seems just arbitrary.

I'm not sure which parts of code could help, if any. I would appreciate any help. Thx

A: 
RouteTable.Routes.Ignore("{resource}.axd");
matt-dot-net
A: 

Settings the menu's RenderingMode attribute to "Table" fixed this problem for me even though I use a Menu Adapter to render the control with lists.

<asp:Menu ID="mnuStuff" runat="server" RenderingMode="Table">
    ...
</asp:Menu>

If you do not need to take advantage of asp 4.0 new css enhancements you can disable the injection of that new Sys.WebForms.Menu altogether with the following setting in the web.config.

<system.web> 
  <pages controlRenderingCompatibilityVersion="3.5"/> 
</system.web>

This will eliminate the rendering of inline javascript that asp injects in the base of the page.

Tim Santeford