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" : "") />