【问题标题】:ASP Dropdownlist not showing in IE 9IE 9 中未显示 ASP 下拉列表
【发布时间】:2017-04-02 14:30:14
【问题描述】:

我正在处理现有的 ASP.NET 代码,并尝试添加一个带有 3 个下拉菜单的对话框。它们在 IE 中调试时在我的机器上工作,即使我将 IE 模拟模式更改为 9,它们也会出现在我的机器上,但是当在测试服务器上的 IE 9 中运行时,下拉菜单根本不可见。加载页面或单击按钮以显示对话框时,控制台中没有 Javascript 错误,并且 DOM Explorer 显示表格行数据有标签,里面有选项,所以我不确定是什么这里出错了。

这是对话框的标记:

<div id="boxCreateSpare" title="Create Assembly" runat="server" style="display: none;">
        <table>
            <tr>
               <td>
                    <asp:Label ID="lblSpareAssemblyID" runat="server" Font-Bold="True"></asp:Label>:
               </td>
                <td>
                    <asp:DropDownList runat="server" ID="selSpareAssemblyID" Width="100%"></asp:DropDownList>
                </td>
                <td>
                    &nbsp;<asp:Label ID="lblSpareDescription" runat="server" Font-Bold="true" Font-Size="12px" Width="120px"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID ="lblTireProductId" runat="server" Font-Bold="true"></asp:Label>:
                </td>
                <td>
                    <asp:DropDownList runat="server" ID="selTireProductId" Width="100%"></asp:DropDownList>
                </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID ="lblWheelProductId" runat="server" Font-Bold="true"></asp:Label>:
                </td>
                <td>
                    <asp:DropDownList runat="server" ID="selWheelProductId" Width="100%"></asp:DropDownList>
                </td>
                <td>&nbsp;</td>
            </tr>
             <tr>
                <td colspan="3" align="center" width="100%">
                    <input type="submit" class="button" style="height: 25px; width: 150px;" id="btnSpareFinishCreate" runat="server" onclick="createSpare()" />
                    <input type="button" class="button" style="height: 25px; width: 150px;" id="btnSpareCancel" runat="server" onclick="$('#boxCreateSpare').dialog('close');" />
                </td>
            </tr>
        </table>
    </div>

测试服务器 IE9 下拉菜单不可见:

我的机器(在模拟 V9 的 IE 中调试)可见:

【问题讨论】:

  • 这可能是您的测试服务器上的数据问题,下拉列表中没有加载数据显示,您是否在其他浏览器上尝试过?
  • width(和其他表示形式)属性在 html4 中已被贬值......它们也以像素而不是 % 为单位。一些弓箭手会使用 % 。使用开发工具的 DOM 资源管理器选项卡突出显示在调试演示文稿时显示为“隐藏”的元素。

标签: html asp.net internet-explorer c#-2.0


【解决方案1】:

想通了。我不确定它与 IE 版本有什么关系,因为我不太精通 IE 知识,但是从“asp:DropDownList runat="server" ID=" 中删除了“width: 100%”样式selSpareAssemblyID"" 使选择出现。我猜发生的事情是表格行的宽度被设置为 0px 或类似的东西,但是将“宽度:100”移动到表格使它们显示出来。有人可能会更详细地说明为什么会发生这种情况,但我就是这样解决的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-23
    • 2013-08-07
    • 2014-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多