【发布时间】:2012-10-17 21:16:28
【问题描述】:
我在视图中
@model IEnumerable<RolesMVC3.Models.Estudent>
.
.
.
@for (var i = 0; i < Model.Count(); i++)
{
<tr>
<td> @Html.CheckBox("CheckValue")</td>
<td> @Html.DisplayFor(m => m[i].CodeEstudent) @Html.HiddenFor(m => m[i].IdEstudent)</td>
<td>@Html.DisplayFor(m => m[i].NameEstudent) @Html.DisplayFor(m => m[i].LastNameEstudent)</td>
</tr>
}
.
.
.
在控制器中:
[HttpPost]
public ActionResult MyController(List<ESTUDENT> estudents, List<bool> CheckValue)
{
///Actions
}
但是,我为每个学生收到了两个 CheckBox。
例如我在控制器中发送 29 并接收 58
如何将 CheckBox 与此列表中的学生关联并进入控制器?
【问题讨论】: