Is there anyway to work with multiple check boxes in MVC. I am getting both true and false values in query string when using the example below.I just want to pass if it was checked True or if it was not checked False.
'http://'webapp':5841/Result/Triggers?Alcohol=true&Alcohol=false&Awakening=true&Awakening=false&Coffee=true&Coffee=false'
public class Triggers
{
public string Alcohol { get; set; }
public string Awakening { get; set; }
public string Coffee {get; set;}
}
@using (HTML.BeginForm("Triggers", "Result", FormMethod.Get))
{
'@Html.CheckBox("Alcohol")'
'@Html.CheckBox("Awakening")'
'@Html.CheckBox("Coffee")'
}
[HttpGet]
public ViewResult Triggers()
{
return View();
}