ASP.net MVC DropDownListFor or DropDownList with Strongly Typed ViewModel
I'm looking for an example of开发者_如何学运维 using DropDownListFor with a strongly typed view model. I have searched extensively and cannot find a good up to date example.
<%= Html.DropDownListFor(m => m.Property,
new SelectList(your_collection, "key", "code", Model.Property), "") %>
"key" and "code" are properties of your Collection objects and the empty "" at the end is an optional label.
精彩评论