Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you specifiy how many items are shown (height) in a listbox

I have this and it shows all of the items in the listbox but there are alot of them

    <label for=”Application”>Application:</label>
    <%= Html.ListBox("SelectedCategories", Model.Applications)%>

is there a way to show just show 5 items and add a scrollbar (compared to increasing the height of the listbox)

like image 751
leora Avatar asked Jul 01 '10 19:07

leora


People also ask

How do I change the size of my ListBox?

Step 2: Drag the ListBox control from the ToolBox and drop it on the windows form. You are allowed to place a ListBox control anywhere on the windows form according to your need. Step 3: After drag and drop you will go to the properties of the ListBox control to set the size of the ListBox.

What property should be used to determine the number of items in a ListBox?

Use the Count property to determine the number of selected items in the ListBox.


1 Answers

You could set the "size" attribute on the select element to 5. Like this:

<%= Html.ListBox("SelectedCategories", Model.Applications, new {size=5})%>
like image 163
nikmd23 Avatar answered Nov 09 '22 00:11

nikmd23