开发者

ASP.net MVC DropDownListFor or DropDownList with Strongly Typed ViewModel

开发者 https://www.devze.com 2023-01-28 02:47 出处:网络
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.DropDownListF

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消