MVC Dropdownlist选择的值在编辑时不重新绑定?

时间:2014-12-18 13:15:27

标签: c# asp.net asp.net-mvc asp.net-mvc-4

我正在使用MVC下拉列表,所选值保存工作正常但编辑填充时间所选下拉列表值未正确绑定所选值。

@model List<eProviderAdmin.Models.ServiceModel>

@Html.AntiForgeryToken()
@Html.ValidationSummary()

<div id="serviceDetails">
@for (var i = 0; i < Model.Count; i++) {
   @Html.LabelFor(m => m[i].Discipline, new { @class = "label-header" })
   @Html.DropDownListFor(m => m[i].Discipline,   ((List<string>)ViewBag.GetDiscipline).Select(x => new SelectListItem() { Text = x, Value = x }), new   { id = "discipline" })
 }
 </div>

0 个答案:

没有答案