Apologies if the title is unclear.
I\'m trying to return my model from a form submit in ASP.NET MVC.
My question is nearly the same as this question, only di
No need to go away from Razor at all.
This works for me:
for (var i = 0; i < Model.UserRoles.Count(); i++)
{
var role = Model.UserRoles[i];
@Html.HiddenFor(model => model.UserRoles[i].RoleId)
@Html.CheckBoxFor(model => model.UserRoles[i].Selected)
@Html.LabelFor(model=> model.UserRoles[i].Name, role.Name)
}