简体   繁体   English

ASP.NET菜单呈现与vs2008和vs2010不同

[英]ASP.NET Menu rendering different from vs2008 to vs2010

I have a web site that was originally built using vs2008. 我有一个最初使用vs2008构建的网站。 We've recently upgraded to vs2010. 我们最近已升级到vs2010。 When i converted the projects to vs2010 projects i told it NOT to update the target framework from 3.5 to 4.0. 当我将项目转换为vs2010项目时,我告诉它不要将目标框架从3.5更新到4.0。 As far as i can tell from looking at all references and the project framework everything is still on 3.5 but for some reason my ASP.NET menus went from rendering html tables to spans. 据我从查看所有引用和项目框架可以看出,所有内容仍然在3.5上,但是由于某种原因,我的ASP.NET菜单从呈现html表变为跨度。 I know that in 4.0 they added Menu.RenderingMode property and defaulted it to List instead of Table but since everything i'm building is 3.5 not only should it render in Table mode but I can't even manually set it to Table mode. 我知道在4.0中,他们添加了Menu.RenderingMode属性并将其默认设置为List而不是Table,但是由于我要构建的所有内容都是3.5,所以它不仅应该以Table模式呈现,而且我什至无法手动将其设置为Table模式。 Anyone know a fix for this (preferably other than a css hack on the spans or upgrading to 4.0)? 任何人都知道解决此问题的方法(最好是跨度上的CSS hack或升级到4.0)? I would just upgrade to 4.0 but we aren't ready for that yet. 我只是升级到4.0,但我们还没有准备好。 I'm not even confident that would fix it since it's not rendering an ol or ul with li tags (a list), it's rendering spans. 我什至没有信心会解决这个问题,因为它没有使用li标签(列表)渲染ol或ul,而是渲染了跨度。

The menu rendering problem is not related to vs2008 to 2010 conversion. 菜单渲染问题与vs2008到2010的转换无关。 asp.menu control of asp.net 3.5 is not rendered properly in chrome and safari. 在chrome和safari中无法正确呈现asp.net 3.5的asp.menu控件。

The easiest way to fix this for both Safari and Chrome is to include your own browser file in App_Browsers in order to disable this adapter. 修复Safari和Chrome的最简单方法是在App_Browsers中包含您自己的浏览器文件,以禁用此适配器。

 <browsers>
  <!-- Disable the Menu Adapter for the Safari browser without changing the root browser file -->
  <browser refID="Safari1Plus">
    <controlAdapters>
      <adapter controlType="System.Web.UI.WebControls.Menu"
               adapterType="" />
    </controlAdapters>
  </browser>
</browsers>

And Just paste the below code in the load event of Page or Master Page (if used). 只需将以下代码粘贴到Page或Master Page的load事件中(如果使用)。

if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
 {
   Request.Browser.Adapters.Clear();
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM