Working with Drop Down Lists8:39 with James Churchill
Let’s see how we can use MVC to work with drop down lists.
To follow along commiting your changes to this course, you'll need to fork the aspnet-fitness-frog repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork> cd aspnet-fitness-frog git checkout tags/v3.1 -b working-with-drop-down-lists
DropDownList vs ListBox
<select> HTML element is flexible enough to render a list that only allows a single selection vs a list that allows multiple selections.
ASP.NET MVC distinguishes between these two approaches by giving them different names—“drop down list” and “list box”. Drop down lists can be rendered using the
DropDownListFor methods and list boxes can be rendered using the
ListBoxFor methods. Just remember that these methods produce the same underlying element—
For more information about the HTML
<select> element, see this MDN (Mozilla Developer Network) page.
You need to sign up for Treehouse in order to download course files.Sign up