html - 不想要下拉列表中的垂直滚动条

标签 html css asp.net

我不希望下拉列表出现垂直滚动条。我想显示所有元素。我该怎么做?

尺寸属性不起作用。

代码设计:

 <asp:DropDownList ID="ddlTables" CssClass="labels" runat="server" AutoPostBack="true" 
                                    AppendDataBoundItems="true" Width="230px"
                                    OnSelectedIndexChanged="ddlTables_SelectedIndexChanged">
                                    <asp:ListItem Text="--Select--" Value="0" />
                                </asp:DropDownList>

enter image description here

最佳答案

滚动条在那里是因为你有太多的元素或太少的高度。假设您想将所有元素都保留在那里,您需要将 this.size 属性设置为一个值,该值将显示所有元素而无需滚动:

<asp:DropDownList ID="ddlTables" 
                  CssClass="labels" 
                  runat="server" 
                  AutoPostBack="true" 
                  AppendDataBoundItems="true" 
                  Width="230"
                  onMouseOver="this.size=50;" 
                  onMouseOut="this.size=1;"
                  OnSelectedIndexChanged="ddlTables_SelectedIndexChanged">
     <asp:ListItem Text="--Select--" Value="0" />
</asp:DropDownList>

关于html - 不想要下拉列表中的垂直滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44625764/

相关文章:

Asp.net Web api 2 Facebook 登录

asp.net - 使用 DataSet 将 RadComboBox 绑定(bind)到 ObjectDataSource

javascript - html5 如何在用户向下滚动时更改图像的位置

iPhone localstorage 生命周期 - 它是否在应用程序更新后仍然存在?

html - 如何使按钮中的图标居中

html - DIV中的图像+文本并保持纵横比

javascript - 如何使选择的下拉列表高于所有其他元素

javascript - 使用 "scale"的 HTML 页面上错误的键盘光标位置

html - 是否在 HTML 文件中包含 Unicode 签名 (BOM)?

c# - 当 dr 中没有数据时,尝试读取无效