listbox item height

Discussion in 'ASP .Net Web Controls' started by bdscarboro@gmail.com, May 11, 2006.

  1. Guest

    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 ...
     
    , May 11, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Prince
    Replies:
    2
    Views:
    3,338
    =?Utf-8?B?TWljaGFlbCBUYXlsb3I=?=
    Oct 19, 2004
  2. Replies:
    0
    Views:
    560
  3. Wotney
    Replies:
    1
    Views:
    535
    Flinky Wisty Pomm
    Oct 25, 2006
  4. tshad
    Replies:
    1
    Views:
    1,694
    bruce barker
    Mar 8, 2007
  5. Bernd Meier
    Replies:
    6
    Views:
    518
    GTalbot
    Jan 14, 2008
Loading...

Share This Page