I'm trying to make the radio button checked based on the roleId in the ViewBag but no matter what the value is the radio button is always checked.
Here is the razor :
<input type="radio" id="rdResident" class="userType" checked="@(ViewBag.roleId=="5"?"checked":"false")" />
All you need the word "checked". Try...
<input type="radio" id="rdResident" class="userType" @(ViewBag.roleId==5 ? "checked" : "") />
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