由ASP.NET菜单控制禁用javascript代 [英] Disable javascript generation by ASP.NET menu control

查看:84
本文介绍了由ASP.NET菜单控制禁用javascript代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站我使用标准ASP.NET菜单控制。我已经走到这一步,作为编写自定义控制适配器摆脱由默认的控制适配器生成的,而俗气的HTML输出。

In my website I'm using the standard ASP.NET menu control. I already got so far as to write a custom control adapter to get rid of the rather tacky html output that is generated by the default control adapter.

有一件事情一直buggering我虽然。不知怎的,ASP.NET的产生,我不想,也不需要为我的菜单控制,因为我不会使用任何的控制动态特性额外的JavaScript。我更换了控制适配器,因此它不会对生成HTML兼容

One thing keeps buggering me though. Somehow ASP.NET is generating extra javascript that I don't want nor need for my menu controls, since I won't be using any of the dynamic features in the control. I replaced the control adapter, so it doesn't generate compatible HTML for that.

任何人有一个想法,我怎么能产生从额外的JavaScript来实现菜单控制prevent ASP.NET?

Anyone got an idea how I can prevent ASP.NET from generating the extra javascript for the menu control?

推荐答案

此问题出现了为升级到ASP.net 4.0后安装的VS 2010的修复方法是强制菜单我呈现为一个表或关闭新的CSS / JavaScript的特色的4.0增加。设置固定的这个问题菜单的属性的renderingMode表对我来说,即使我用一个菜单适配器渲染列表控制。

This problem cropped up for me after upgraded to ASP.net 4.0 with the installation of vs 2010. The fix is to either force the menu to render as a table or to turn off the new CSS/javascript "features" that 4.0 adds. 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>

您可以做这个网站范围的设置controlRenderingCompatibilityVersion为 3.5 在web.config:

You can do this site wide setting controlRenderingCompatibilityVersion to 3.5 in the web.config:

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

这将消除内嵌的渲染JavaScript代码的ASP页面的基础上注入。

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

这篇关于由ASP.NET菜单控制禁用javascript代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆