MVC4: Two radio buttons for a single boolean model property

Try like this: @Html.RadioButtonFor(model => model.IsFemale, “false”) Male @Html.RadioButtonFor(model => model.IsFemale, “true”) Female And here’s the full code: Model: public class MyViewModel { public bool IsFemale { get; set; } } Controller: public class HomeController : Controller { public ActionResult Index() { return View(new MyViewModel { IsFemale = true }); } [HttpPost] public ActionResult Index(MyViewModel … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)