I have a class for MoreInfo:
public class MoreInfo
{
public string Name { get; set; }
public string selectedCheckboxItems {get; set;}
}
I want to know how to create a checkbox list on the view and pass the checked off items to my controller on submit.
How would I go about creating the checkbox list and how to pass all the checked items and process them?
Let’s modify your model a little:
then you could have a controller:
then you would have a corresponding view (
~/Views/Home/Index.cshtml) which would contain the form allowing the user to check/uncheck values:and finally the editor template (
~/Views/Home/EditorTemplates/ItemViewModel.cshtml):