I have this form in my view:
@using (Html.BeginForm()) { @Html.HiddenFor(o=>o.NoteId) for (int i = 0; i < Model.Friends.Count; i++) { <table> <tr> <td> <p style="font-size: 1.3em; color: black">@Model.Friends[i].Name</p> </td> <td> @Html.CheckBoxFor(x => @Model.Friends[i].Checked) </td> </tr> </table> } This displays a name with a checkbox next to it. When i post it to my controller it passes the values in the checkboxes but it does not post the names. Is it possible to just "display" tha names but still pass it to my controller on submit?
I tried something like this:
@Html.LabelFor(x => @Model.Friends[i].Name) But it only displays the property (name) in front of my checkbox. Any tips on how to achieve this?
@Html.HiddenFor