By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. You need to pass a string containing the radio name 'x', not pass a variable x: Thanks for contributing an answer to Stack Overflow! If the TextBox has value, the Button is enabled and if the TextBox is empty, the Button is disabled using JavaScript. XML <li> @Html.LabelFor (m => m.UserName) @if (Model.IsEditMode==false) { @Html.TextBoxFor (m => m.UserName,new {disabled="disabled"}) } else { @Html.TextBoxFor (m => m.UserName) } </li> Using the code