我有一个带有 AjaxControlToolkit 的 Asp.Net Webforms 应用程序,它不能在 IE9 上正确显示 html 列。
这个问题只是偶尔发生,没有明确的时间/方式模式。 它在 Firefox 上运行良好。 生成的 HTML 部分/表格已经使用 W3C 工具进行了验证并且没有问题。我没有在 CSS 中找到任何可以解释这种行为的内容。此外,此 ascx 文件中没有自定义 Javascript。
我怀疑这是一个 IE9 错误,我正在考虑向 Microsoft 支持部门开具票证。 我们正在使用 AjaxControlToolkit V4.1.7.1213。我已经尝试使用 Asp.Net Repeater 而不是 ListView 并将其部署在不同的服务器(IIS7、IIS6 等)中,但我没有运气。
<asp:UpdatePanel ID="UpdatePanelConselho" ChildrenAsTriggers="false" UpdateMode="Conditional"
runat="server">
<ContentTemplate>
<table class="CorpGrid2" cellspacing="0">
<tr class="CorpGrid2Header">
<td class="CorpGrid2Cell" style="width: 36px">M/F ou Cia
</td>
<td class="CorpGrid2Cell" style="width: 180px">Nome
</td>
<td class="CorpGrid2Cell" style="width: 110px">CPF / CNPJ
</td>
<td class="CorpGrid2Cell" style="width: 110px">Data de Nascimento ou Idade
</td>
<td class="CorpGrid2Cell" style="width: 150px">País de Origem
</td>
<td class="CorpGrid2Cell" style="width: 110px">Cidadania
</td>
<td class="CorpGrid2Cell" style="width: 120px">Função
</td>
<td class="CorpGrid2Cell" style="width: 60px">Tomador de Decisões
</td>
<td class="CorpGrid2Cell" style="width: 60px">OFAC-SDN
</td>
<td class="CorpGrid2Cell" style="width: 60px">PEP / Lynx (High Risk)
</td>
</tr>
<asp:Repeater ID="ListViewConselho" runat="server" OnItemDataBound="ListViewConselho_ItemDataBound">
<ItemTemplate>
<tr class="CorpGrid2Data">
<td class="CorpGrid2Cell">
<asp:DropDownList ID="DropDownListGenero" runat="server" onchange="definirPepLynx();" CssClass="PepLynxConselho">
</asp:DropDownList>
</td>
<td class="CorpGrid2Cell">
<asp:HiddenField ID="HiddenFieldCodigo" runat="server" Value='<%# Eval("RegCode") %>' />
<asp:TextBox ID="TextBoxNome" runat="server" Text='<%# Eval("MemberName") %>' Width="180px"
MaxLength="255"></asp:TextBox>
</td>
<td class="CorpGrid2Cell">
<asp:TextBox ID="TextBoxCNPJ" runat="server" Text='<%# Eval("MemberLastName") %>'
Width="110px" MaxLength="255"></asp:TextBox>
</td>
<td class="CorpGrid2Cell">
<asp:TextBox ID="TextBoxIdade" runat="server" Text='<%# Eval("Age") %>' Width="110px"
MaxLength="50"></asp:TextBox>
</td>
<td class="CorpGrid2Cell">
<asp:DropDownList ID="DropDownListPaisOrigem" runat="server">
</asp:DropDownList>
</td>
<td class="CorpGrid2Cell">
<asp:TextBox ID="TextBoxCidadania" runat="server" Text='<%# Eval("Citizenship") %>'
Width="110px" MaxLength="50"></asp:TextBox>
</td>
<td class="CorpGrid2Cell">
<asp:TextBox ID="TextBoxFuncao" runat="server" Text='<%# Eval("FunctionDescription") %>'
Width="120px" MaxLength="255"></asp:TextBox>
</td>
<td class="CorpGrid2Cell">
<asp:DropDownList ID="DropDownListTomadorDecisao" runat="server">
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="Sim" Value="S"></asp:ListItem>
<asp:ListItem Text="Não" Value="N"></asp:ListItem>
</asp:DropDownList>
</td>
<td class="CorpGrid2Cell">
<asp:DropDownList ID="DropDownListOFAC_SDN" runat="server">
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="Sim" Value="S"></asp:ListItem>
<asp:ListItem Text="Não" Value="N"></asp:ListItem>
</asp:DropDownList>
</td>
<td class="CorpGrid2Cell">
<asp:DropDownList ID="DropDownListPEP" runat="server" onchange="definirPepLynx();" CssClass="PepLynx">
<asp:ListItem Text="" Value=""></asp:ListItem>
<asp:ListItem Text="Sim" Value="S"></asp:ListItem>
<asp:ListItem Text="Não" Value="N"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButtonAddConselho" />
</Triggers>
</asp:UpdatePanel>
谁能帮忙看看发生了什么事?
最佳答案
关闭和打开 TD 标签之间的额外间距似乎是一个问题。这是一个已知的错误。 试试这个代码:
$("table").each(function(index) {
$(this).html($(this).html().replace(/td>\s+<td/g,'td><td'));
});
看看这个: Internet Explorer 9 not rendering table cells properly
另请查看 IE 博客。他们有一个工具(不应该存在)来检查页面与 IE9 的兼容性: http://blogs.msdn.com/b/ie/archive/2011/04/27/ie9-compat-inspector.aspx
关于HTML 列位移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24062101/