下拉列表应显示5个项目,仍在滚动 [英] Drop down list should show 5 items, remaining on scroll

查看:79
本文介绍了下拉列表应显示5个项目,仍在滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个相邻的下拉列表。一个用于选择小时,另一个用于分钟。因此小时下拉列表包含24个项目,分钟下拉列表包含59个项目。我希望两个下拉列表都能显示5个项目和滚动的其他项目。



I am having two drop down list adjacent to each other. One is used to select hour and another for minute. So hour drop down list contains 24 items and minute drop down list contains 59 items. I want that both drop down list should show 5 items and other items on scroll.

<asp:DropDownList ID="dropDownHr" runat="server" >
    <asp:ListItem>1</asp:ListItem>
    <asp:ListItem>2</asp:ListItem>
                  .
                  .
       </asp:DropDownList>

<asp:DropDownList ID="dropDownMin" runat="server" >
    <asp:ListItem>1</asp:ListItem>
    <asp:ListItem>2</asp:ListItem>
                  .
                  .
       </asp:DropDownList>





提前感谢您的帮助。



Thanks for help in advance.

推荐答案

Refere this,

http://blogs.msdn.com/b/rakkimk/archive/2011/05/02/dropdownlist-html-select-vertical-scrollbar-number-of-items.aspx [ ^ ]



-KR
Refere this,
http://blogs.msdn.com/b/rakkimk/archive/2011/05/02/dropdownlist-html-select-vertical-scrollbar-number-of-items.aspx[^]

-KR


尝试使用下面的代码。

Try to use below code.
<asp:DropDownList runat="server" ID="ddlColors" onmousedown="this.size=5;"  >
        <asp:ListItem>Red</asp:ListItem>
        <asp:ListItem>Green</asp:ListItem>
        <asp:ListItem>Blue</asp:ListItem>
        <asp:ListItem>Yellow</asp:ListItem>
        <asp:ListItem>White</asp:ListItem>
        <asp:ListItem>Black</asp:ListItem>
        <asp:ListItem>Purple</asp:ListItem>
        <asp:ListItem>no color</asp:ListItem>
</asp:DropDownList>







.dropmenudiv
{
  height: 300px;
  max-height: 300px;
  overflow-y: scroll;
}


这篇关于下拉列表应显示5个项目,仍在滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆