简体   繁体   English

ASP:菜单在IE10和IE11中未正确显示,但在Chrome,FF和IE9中看起来都不错

[英]ASP:Menu not shown correctly in IE10 and IE11, but looks aliright in Chrome, FF and till IE9

I am using a asp:Menu control to create a tabbed navigation. 我正在使用asp:Menu控件来创建选项卡式导航。 The project was created in .Net 4.0. 该项目是在.Net 4.0中创建的。

The following is used to create tabs: 以下用于创建选项卡:

<div class="tabmenustyle displayblock">
    <asp:Menu ID="_TabMenu" runat="server" Orientation="Horizontal">
    </asp:Menu>
</div>

This is creating the tabbed structure properly in all browsers except IE10,IE11. 这将在除IE10,IE11之外的所有浏览器中正确创建选项卡式结构。

The actual tabs look like this properly in the mentioned browser: 实际的标签在上述浏览器中看起来像这样:

Image for Expected (as seen in IE8,Chrome,FF) 预期的图片(如IE8,Chrome,FF中所示)

But in IE10 and IE11 the tabs are not displayed. 但是在IE10和IE11中,不显示选项卡。 The links are there if carefully observed, but with the following problems: 如果仔细观察,链接就会存在,但存在以下问题:

  1. They are barely visible. 它们几乎看不见。 They are put behind the text instead of as tabs. 它们被放在文本后面,而不是作为标签。
  2. Basically, the tabs are not created. 基本上,不创建选项卡。

Image for Tabs in IE11 IE11中选项卡的图像

I have tried the following: 我尝试了以下方法:

  1. Adding the meta http-equiv="X-UA-Compatible" content="IE=7,8" tag. 添加meta http-equiv =“ X-UA-Compatible” content =“ IE = 7,8”标签。
  2. Adding .browser files for compatibility to App_Browser file. 添加.browser文件以与App_Browser文件兼容。
  3. Migrate all projects in the solution to .Net framework 4.5.2 from 4.0. 将解决方案中的所有项目从4.0迁移到.Net Framework 4.5.2。
  4. Applying a z-index CSS property to the asp:menu control. 将z-index CSS属性应用于asp:menu控件。
  5. Also tried setting the Page.ClientTarget to "uplevel" in Page_Load. 还尝试在Page_Load中将Page.ClientTarget设置为“ uplevel”。 To no avail. 无济于事。

I am at my wits' end. 我没办法。 What all should I try to make it show properly in IE10 or IE11. 我应该怎么做才能使其在IE10或IE11中正确显示。

Edit: Additional details - What I observed is that when the browser is IE10 or IE11, the HTML sent to the browser is a table. 编辑:其他详细信息-我观察到的是,当浏览器是IE10或IE11时,发送到浏览器的HTML是一个表。 But for all others, a < ul > is sent with < li > as navigation menu items. 但是,对于其他所有对象,将发送<ul>和<li>作为导航菜单项。 What could be the reason that IE10 or IE11 are sent different HTML. IE10或IE11发送不同HTML的原因可能是什么。

Final after trying a multitude of solutions, I again tried to pinpoint the problem. 最后,在尝试了多种解决方案之后,我再次尝试找出问题所在。 Adding the .browser file in the App_Browser should have worked earlier. 在App_Browser中添加.browser文件应该可以更早地工作。 The reason was because it was overriding the base .Net definitions when I added my own IE11 or IE10 specific definitions browser files. 原因是因为当我添加自己的IE11或IE10特定定义浏览器文件时,它覆盖了基本的.Net定义。

The key was to use the refId to refer IE11 or IE10 at the project level app.browser and keep the value of refID equal to the Id used in the browser file located at c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\Config\\Browsers. 关键是在项目级别的app.browser中使用refId引用IE11或IE10,并使refID的值等于位于c:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319的浏览器文件中使用的ID。 \\ Config \\浏览器。 This adds rules over and above the existing ones. 这将在现有规则之上添加规则。 Otherwise, it simply overrides the existing definitions. 否则,它将仅覆盖现有定义。

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

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