Click here to Skip to main content
15,877,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.NET
<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.
Posted

 
Share this answer
 
Comments
Ami_Modi 17-Feb-14 0:06am    
I don't have DropDownExtender in Ajax control list. Help me what to do.
Try to use below code.
XML
<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>


CSS
.dropmenudiv
{
  height: 300px;
  max-height: 300px;
  overflow-y: scroll;
}
 
Share this answer
 
Comments
Krunal Rohit 16-Feb-14 23:37pm    
you forget to apply CSS
<asp:DropDownList ID="" runat="" CssClass="dropmenudiv">

-KR
Ami_Modi 17-Feb-14 0:04am    
None of them is working as I want.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900