开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜