Help Needed

Help Needed

  • NA
  • 13
  • 22.8k

mvc checkboxes selection

Aug 23 2016 12:45 PM

Hi

 

 I am working with checkboxes in MVC.I have a table with one clolumn as "bit" type.The following code giving me error

 [HttpPost]
 public string Index(IEnumerable<City> cities) 
{ 
if (cities.Count(x => x.Chosen) == 0)
 {
 return "You did not select any city"; 
}

Chosen is a bit type here. and when i am trying to build it says "

 

 Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?) 


Answers (3)