I have a List collection in my strongly typed viewdata.
How do I use the Html.DropDownList helper?
<%= Html.DropDownList(ViewData.Model.Cars) %>
(the above doesn’t work, doesn’t seem to match any of the signatures)
This is MVC2.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your
Carclass looked something like thisAnd you put a property on your view model like this
Your resulting view model would look like this
You could do this
When posted,
CarIdwould get get bound to the bound by the default model binder if the view model was a parameter to theAction.