mvc 4 radiobuttonfor binding with model

301 views Asked by At

I am validating radiobuttonfor with data annotations. making it a required in model. but it's not working. below is my code.

In view.

@Html.RadioButtonFor(m => m.IsMedicalInsurance, true, new { id="rdhaveinsu"}) Yes           
@Html.RadioButtonFor(m => m.IsMedicalInsurance, false, new { id="rdhavenoinsu"})No
@Html.ValidationMessageFor(m => m.IsMedicalInsurance)

In Model.

 [Required(ErrorMessage="Please update about medical insurance")]
 public bool IsMedicalInsurance { set; get; }
0

There are 0 answers