listbox item height

B

bdscarboro

Folks,
I need to set the height of a listbox based on the number of items
it contains such that its height contains all the items perfectly with
no scroll bar. With a WinForms listbox, there is the ItemHeight
property, but apparently there is no equivalent with the WebControls
listbox? I have tried using the Rows property with no success. As a
temporary solution, I have done this:

lstNames.Height = lstNames.Items.Count * 13

Since each item is 13 pixels high on my screen, this works perfectly on
my machine, but I'm a little worried about other displays with
different resolution etc.

Is there a programmatic way to determine the height of an item in the
listbox?

Thanks in advance for any tips ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top