I have a simple project that I want to send information via form and multiple check boxes in asp.net mvc.
This is the view:
And this is the controller method:
[HttpPost]
public ActionResult Index(Customer customer)
{
if (customer != null)
{
return Content(customer.Name.ToString());
}
return Content("empty");
}
I know that I am getting a single variable in the controller method but the point is that if I put an IEnumerable
type like list, array or even IEnumerable
itself I will receive null value, and if I put a single variable the view page only sends the value of the first checkbox.
Here you can see that I have chosen the B option but the view still returns the A option.