You can pass values ββdirectly as htmlAttributes, for example:
@Html.RadioButtonFor(m => m.WantIt, "false", new {disabled = "disabled"}) @Html.RadioButtonFor(m => m.WantIt, "true", new {disabled = "disabled"})
If you need to check the model. Now you can do something like this:
@{ var htmlAttributes = new Dictionary<string, object>(); if (Model.Alive) { htmlAttributes.Add("disabled", "disabled"); } } Test 1 @Html.RadioButton("Name", "value", false, htmlAttributes) Test 2 @Html.RadioButton("Name", "value2", false, htmlAttributes)
Hope that helps
amhed source share