Friday, 3 August 2018

@Html.RadioButtonFor Default to Unchecked

In ASP.NET MVC4's Razor view, how to ensure none of the radio buttons default to unchecked? MVC seems to check one for me even I don't declare to check one in the following codes.

@Html.RadioButtonFor(model => model.test, true, new { id = "radio_test_True"}) Yes
@Html.RadioButtonFor(model => model.test, false, new { id = "radio_test_False"}) No

Thanks



from @Html.RadioButtonFor Default to Unchecked

No comments:

Post a Comment