mardi 31 octobre 2017

Get several checkboxes from view to controller in MVC 5

I have a view with multiple of checkboxes for the user to choose from, different options, but how can I get these either boolean values or ids' from these checkboxes back to the controller? I only get the checkboxes appear next to the value (a string of a department).

So when I click on any checkbox, really nothing goes back to the controller.

The simplest code is something like @Html.CheckBoxFor(model => item.Selected) e.g., and these under a foreach loop.




Aucun commentaire:

Enregistrer un commentaire