简体   繁体   中英

how to set dropdownlist height and how to show dropdownlist's list always downward display

How can I set a dropdownlist control's height in C#?

I tried this, but it doesn't work:

cbo.Attributes.Add("style", "height: 50%");  

And, how can I make sure a dropdownlist's list is always dropped down rather than up?


At last I got it..

 cbo.Height = new Unit("250px");

I can set dropdownlist height with above code.

Temporarily you can increase the font size of the items in the dropdown control, this will set height. Will try to find a better solution.

You can set the height of a dropdownlist as follows:

combobox1.DropDownHeight = 106;

Make sure that the DrawMode attribute of the combobox is set to Normal . This way it's items can be populated without much difficulty.

The answer to "How to set height" is:

   cbo.Height = new Unit("250px");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM