How to Set RadioButtonFor() in ASp.net MVC 2 as Checked by default
Use the simple way: <%= Html.RadioButtonFor(m => m.Gender, “Male”, new { Checked = “checked” })%>
Use the simple way: <%= Html.RadioButtonFor(m => m.Gender, “Male”, new { Checked = “checked” })%>
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