How do I ensure that a radio button list has the first option selected? If it is based on the model property, how is this set if this is the first page that is shown on application start-up?
This is easy peasy in webforms but I don't know how to do this in MVC and there doesn't seem to be anywhere on the NET which shows how this is done.
This doesn't seem to work:
@Html.RadioButtonFor(m => m.SearchType, true) Location
@Html.RadioButtonFor(m => m.SearchType, false) Name
I Just get both radio buttons unselected??
@Html.RadioButtonFor(x => x.Something, "radioValue", new { @checked = true })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With