ASP.NET - to reduce the height of the dropdownlist

Asked By vishal kumar on 31-Jul-09 01:30 AM
Hi all,

I have a drop down list box in my aspx web page.

I am populating the drop down list from sql database. There is a huge list of data to be shown in the drop down list. So when i click on the drop down button it show a very long scroll bar.

I want to reduce the height of the drop down list scroll window. How can I do this?

I tried to set the "Height" attribute of the Dropdown list box to a fixed value it doesn't seem to work.

So can anybody suggest me on how to fix the height of the dropdown list box?
ASAP..

Thanks,

Vishal.

sri sri replied to vishal kumar on 31-Jul-09 02:17 AM
hi,

It is not possible to reduce the height of the drop down list.

 instead of dropdown try with the list box or autocomplete (toolkit)

or

you can go with custom dropdown list

visit the below link to create custom dropdown list

http://aspalliance.com/541_Multiple_Column_DropDown_Box_for_ASPNET.all


Harry L replied to vishal kumar on 31-Jul-09 02:25 AM


Hi,

If you change the font-size of the dropdownlist it will resize it's height. It will work for all browsers to accommadate the text so therefore should 'fit in' with the rest of your page.


As far as style - height is conisidered it will not work for IE browser

Regards,
Harry


RE - Ravenet Rasaiyah replied to vishal kumar on 31-Jul-09 02:39 AM

Hi

In the windows we have property call MaxDropDwownItem. but not in the asp.net dropdownlist.

So you can use the followings

1. you can use the auto complete combo box which is come with AJAX

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx

2. you can extend  the standard drop down control like this way.

http://www.codeproject.com/KB/custom-controls/multiColsDD_List.aspx

Thank you
http://www.codegain.com
Try specifying thru a CSS or use a Listbox Instead. - [)ia6l0 iii replied to vishal kumar on 31-Jul-09 12:41 PM
Code:
.limitheight
{
     height: 75px;
}

<asp:DropDownList ID="ddlData" runat="server" CssClass="limitheight" />

Or use ListBox where you could set the number of visible items property.