I have a model that brings in user information. I want to submit that information in a form, but I'm having trouble submitting information since regardless of how many items are in the list. It will only submit the first one.
@using (Html.BeginForm("Action", "Controller", FormMethod.Post))
{
<table>
foreach(var item in Model)
{
<tr>
<td>@Model.UserName</td>
<td>@Html.TextBoxFor(a => Model.LoginName})</td>
<td>@Html.TextBoxFor(a => Model.EmployeeNumber})</td>
<input type="submit" value="Submit">
</tr>
}
</table>
}
Everything else works, I check the controller and see that the first parameters are being passed in on submit. The list is being populated from a database. I've looked into using SingleOrDefault(), but I don't think that will work in this case.