Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Let’s see how we can use MVC to work with drop down lists.
Follow Along
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
The <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 DropDownList
or DropDownListFor
methods and list boxes can be rendered using the ListBox
or ListBoxFor
methods. Just remember that these methods produce the same underlying element—<select>
.
For more information about the HTML <select>
element, see this MDN (Mozilla Developer Network) page.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up