I have a form with a list of checkboxes. A user can select all values, no values, or any in between. Example:
You can also do Using jquery.No need to change any controller or action.It will simply add the selected checkboxes value in the database table's column as a coma separated.Just add the code in the View Page.
@Html.HiddenFor(model => model.hobbies, new { htmlAttributes = new { id = "hobbies" } })
Hobbies :
Reading
Writing
@Html.ValidationMessageFor(model => model.hobbies)