Radio check/uncheck in mvc 4 razor
asp.net, asp.net-mvc-4, radio-button, razor
Solution
All you need the word "checked". Try...
<input type="radio" id="rdResident" class="userType" @(ViewBag.roleId==5 ? "checked" : "") />
Problem
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")" /> ```