I have a view in MVC3, that has bunch of check boxes. The user checks one or more check boxes and clicks on submit. On submit, I would like to display the checked boxes values in a partial view or a view.
<table>
<tr><td> @Html.Label("Label1")</td><td> @Html.CheckBox("CB1")</td></tr>
<tr><td> @Html.Label("Label2")</td><td> @Html.CheckBox("CB2")</td></tr>
<tr><td> @Html.Label("Label3")</td><td> @Html.CheckBox("CB3")</td></tr>
</table>
@Html.ActionLink("Submit", "SubmitCB")
Controller action:
public ActionResult SubmitCB()
{
@foreach (var checked in ?)
{
//Display checked only here...
}
}
I was wondering how I can loop through and display the results in a partial view or a view. Thanks for your help.