Hi I have a ModelBinded View
foreach (var Model in Model)
{
@Html.RadioButtonFor(modelItem => Model.DefaultLocation, Model.AddressID, new { @Checked = Model.DefaultLocation, id = Model.AddressID })
}
@Checked is retrieved from Database as Boolean True or False.
HTML generated for this Razor code is as Below
<input checked="True" id="27" name="model.DefaultLocation" type="radio" value="27">
<input checked="False" id="28" name="Model.DefaultLocation" type="radio" value="28">
Though it says id=”27″ as Checked= “true”
my page is showing the last radio button as selected.
I am trying to achieve that what ever the return value form the database says true, that Radio button should be selected by default.
I am not able to figure out whats wrong.
can any one help me to fix this issue?
thank you for your time.
1 Answer