views:

16

answers:

2

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)

A: 

Checkout this blog post.

Darin Dimitrov
@Darin Dimitrov - i appreciate this article and agree with a lot of the points of the author. That being said, i think he breaks his own rules. The idea that selecting a dropdown box would then add that items to a list is NOT intuitive at all. Dropdowns are for selection / filtering etc, not for adding items to other lists imo
ooo
+1  A: 

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

<%= Html.ListBox("SelectedCategories", Model.Applications, new {size=5})%>
nikmd23