ASP.NET MVC 4 application allows to mark table rows. Razor view contains:
@using (Html.BeginForm())
{
<table class="table table-hover">
@foreach (var f in Model.Failid)
{
<tr>
<td>@f.FailiNimi</td>
<td>
@Html.CheckBox("c" + f.Id.ToString())
</td>
</tr>
}
</table>
<input type="submit" class="btn btn-success" />
@Html.AntiForgeryToken()
}
If submit button is pressed, browser sends post request with body like
c40=false&c9=true&c9=false&c9=false&c10=false&c13=false
Controller signature is
[HttpPost, ValidateAntiForgeryToken]
public ActionResult Failid(NameValueCollection nv)
{
...
However nv parameter value in controler is empty. Checkbox names are not passed as controller parameter.
How to get list of checked checkbox names in controller ?