Dynamic list of checkboxes and model binding
I'm trying to create a view that contains a list of checkboxes that is dynamically created from a database, and then retrieve the list of selected ones when the form is posted back. My EF model contains a class: public class ItemIWouldLikeACheckboxFor { public int Id { get; set; } public string Description { get; set; } } I have a view model that contains a list of these: public class PageViewModel { // various other properties public List<ItemIWouldLikeACheckboxFor> checkboxList { get; set; } } My controller get method: public ActionResult Create() { var viewModel = new PageViewModel();