现在的位置: 首页 > 综合 > 正文

解决 asp.net 中如果 Menu 控件放在 MasterPage 中, IE6 会出现的二级菜单不能正确显示的问题

2013年03月12日 ⁄ 综合 ⁄ 共 863字 ⁄ 字号 评论关闭

 

以下是原文,我采用的是第二种方式,只加一行代码就能搞定,简单有效。第一种方式没有测试过,由于担心会影响到已测试过的其它功能,所以没有用。

 

> A lot of users are finding that after moving their ASP.NET 1.1 site to ASP.NET 2.0 and then adding a Menu Control to their app, the Menu doesn't work.
>
> The reason this doesn't work is that an extra tag was added to web.config <xhtmlConformance mode="Legacy" /> This flag was meant for 2.0 to act a lot more like 1.1 and one of the major differences is the naming convention of controls. This naming change causes the quirky behavior with Menu in IE.
>
> There are 2 fixes for this issue:
>
> 1) Remove the xhtmlConformance tag from web.config
> Personally if you can do it, I recommend this option. If you're using ASP.NET 2.0 features, you should try and stick with the new rendering modes.
>
> 2) If you can't do #1, then give your masterpage an ID
> To do this, add a line to your Page_Load for your Masterpage:
>
> public partial class MasterPage : System.Web.UI.MasterPage
> {
> protected void Page_Load(object sender, EventArgs e)
> {
> this.ID = "Master1";
> }
> }

抱歉!评论已关闭.