【发布时间】:2014-06-17 13:36:16
【问题描述】:
这行得通
@Html.DropDownListFor(model => Model.Assessment.Interviewer, Model.SiteListing)
这不是
<div class="resident-relationship">@Html.DropDownListFor(m => Model.HouseholdMembersListing.ElementAt(i).Relationship, Model.ResidentTypeListing, new { @class = "t150"})</div>
如何正确使用 @HTML.DropdownListFor 绑定到 Listanything> 以便在 POST 到控制器时它具有值?我在一个家庭中有很多居民的页面上有这个。我还有其他绑定,例如姓名和年龄,它们运行良好。但在关系上,我需要有下拉列表。
【问题讨论】:
标签: asp.net-mvc-3 model-view-controller html-helper html.dropdownlistfor