Question

I have tried to add a scroll bar on dropdownlist but it not working perfect how i can add a scroll bar?

<asp:DropDownList ID="Inventory_No_dropdown" 
                  runat="server" 
                  Font-Bold="true"
                  onmousedown="this.size=5;" 
                  onfocusout="this.size=1;" 
                  ondblclick="this.size=1;" 
                  class=""  
                  CssClass="span3" 
                  Style="position: absolute !important;"
                  AppendDataBoundItems="True" 
                  AutoPostBack="True" 
                  onselectedindexchanged="Inventory_No_dropdown_SelectedIndexChanged">
<asp:ListItem  Value="0" >--------SELECT--------</asp:ListItem>

 </asp:DropDownList>
Was it helpful?

Solution

Try this

<asp:DropDownList ID="Inventory_No_dropdown" 
                  runat="server" 
                  Font-Bold="true"
                  onmousedown="this.size=5;" 
                  onfocusout="this.size=1;" 
                  ondblclick="this.size=1;" 
                  class=""  
                  CssClass="span3 dropmenuScroll" //or  CssClass="dropmenuScroll"
                  Style="position: absolute !important;"
                  AppendDataBoundItems="True" 
                  AutoPostBack="True" 
                  onselectedindexchanged="Inventory_No_dropdown_SelectedIndexChanged">
<asp:ListItem  Value="0" >--------SELECT--------</asp:ListItem>

 </asp:DropDownList>

css style

.dropmenuScroll
{
  height: 300px;
  max-height: 300px;
  overflow-y: scroll;
   position:absolute;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top