Hi Funce,
Many thanks for your quick reply. Actually as mentioned above, I have tried putting checked = "checked", this works fine for a standard radio button, but I am trying to use the Bootstrap 4 custom radio buttons explained at https://www.w3schools.com/bootstrap4/bootstrap_forms_custom.asp.
The HTML code I'm using is: (razor pages asp.net core 2.2)
<div class="custom-control custom-radio custom-control-inline @Model.LocalActive">
<input type="radio" class="custom-control-input @Model.LocalActive" id="customRadio" name="example" value="Local">
<label class="custom-control-label SIHGYellow @Model.LocalActive" for="customRadio" @Model.LocalChecked>Local</label>
</div>
<div class="custom-control custom-radio custom-control-inline @Model.AbroadActive">
<input type="radio" class="custom-control-input @Model.AbroadActive" id="customRadio2" name="example" value="Abroad">
<label class="custom-control-label SIHGYellow @Model.AbroadActive" for="customRadio2" @Model.AbroadChecked>Abroad</label>
</div>
and the code behind file is
if(donorDetails.TypeOfDonor == "Local")
{
LocalChecked = "checked";
LocalActive = "active";
AbroadChecked = string.Empty;
AbroadActive = string.Empty;
}
else
{
LocalChecked = string.Empty;
LocalActive = string.Empty;
AbroadChecked = "checked";
AbroadActive = "active";
}
as you can see, I'm using both 'checked' and 'active' but neither seems to work for me.
Any Ideas?
NIck