views:

892

answers:

1

If you have a select list set to multiple in ASP.NET MVC, how does the modelbinding work?

What does it return for your selected items, an array?

<SELECT NAME="toppings" MULTIPLE SIZE=5>
    <option value="mushrooms">mushrooms</option>
    <option value="greenpeppers">green peppers</option>
    <option value="onions">onions</option>
    <option value="tomatoes">tomatoes</option>
    <option value="olives">olives</option>
</SELECT>
+2  A: 

Yes, by default a multiselectlist will post through an array of the selected values.

This article has further information, including how to use strongly-typed views with a multiselectlist.

Sam Wessel