Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollbar in checkbox list in asp.net

i am using VS 2005, in asp.net please tell me how can i show scroll bar in checkboxlist after the number of item count goes beyond the specified. like my situation that if their exist more then 5 items in my checkbox list than it should show a scroll bar.. and i dont want to fix its height like if their is only 1 item than it should take space of 1 item only.... please help me...

i have used this but its taking space (Hight) even their is 1 or 2 items in list.. div style="overflow-y :auto; height :100px "

like image 397
Dr. Rajesh Rolen Avatar asked May 12 '10 07:05

Dr. Rajesh Rolen


1 Answers

Instead of fixing the height with a static value, you can set the max-height of the container div. In this case it will use auto height as long as it's less than the height you specified :)

P.S. To make the max-height cross-browser compatible, you have to set it as follows in your css:

.checkBoxList {
  max-height:100px;
  height:auto !important;
  height:100px;
}
like image 52
Artiom Chilaru Avatar answered Sep 28 '22 15:09

Artiom Chilaru