locked
ListBox vs ListView RRS feed

  • Question

  • User260076833 posted

    Hello,

    I would like to have a list of names at the left and the details to the right.
    And I wonder if I should use ListBox or ListView or something different?

    One requirement would be that the list is as height as the available space. When there are too much items, then a vertical scrollbar should appear, no pager.

    Which type of control would be better?

    Anyhow, how can I achieve that the control uses and fits the available vertical space?
    The ListBox for example acceps only a pixel-defined height.

    How would you do that?

    Thanks
    Magnus

    Friday, December 30, 2016 5:39 PM

All replies

  • User-271186128 posted

    Hi Magnus,

    I would like to have a list of names at the left and the details to the right.
    And I wonder if I should use ListBox or ListView or something different?

    To display the name, you could use The ListBox, to display the detail information, you could use ListView or DetailsView control.

    More details about using this control, you could check the official document.

    One requirement would be that the list is as height as the available space. When there are too much items, then a vertical scrollbar should appear, no pager.

    Which type of control would be better?

    Anyhow, how can I achieve that the control uses and fits the available vertical space?
    The ListBox for example acceps only a pixel-defined height.

    As for this issue, you could put these controls into a div, then use the CSS overflow property to add the scrollbar. Like this:

    <div style="width: 500px; height: 400px; overflow: scroll">your ListView or DetailsView</div>

    More details about the CSS property, see:

    http://www.w3schools.com/cssref/pr_pos_overflow.asp

    http://www.w3schools.com/cssref/css3_pr_overflow-y.asp

    Best regards,
    Dillion

    More details

    Monday, January 2, 2017 9:06 AM