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. Advertisements

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,591
    =?Utf-8?B?TWljaGFlbCBUYXlsb3I=?=
    Oct 19, 2004
  2. Replies:
    0
    Views:
    749
  3. Wotney
    Replies:
    1
    Views:
    696
    Flinky Wisty Pomm
    Oct 25, 2006
  4. tshad
    Replies:
    1
    Views:
    1,893
    bruce barker
    Mar 8, 2007
  5. Bernd Meier
    Replies:
    6
    Views:
    719
    GTalbot
    Jan 14, 2008
  6. samer
    Replies:
    3
    Views:
    625
    Gregory A. Beamer
    Sep 28, 2009
  7. muggslab

    Div Height = Image height. help

    muggslab, Feb 1, 2010, in forum: HTML and CSS
    Replies:
    1
    Views:
    1,131
    muggslab
    Feb 1, 2010
  8. JC

    textbox height = containing cell height - x

    JC, Jul 29, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    359
    DujHoD
    Aug 2, 2004
Loading...