禁用并选择asp.net mvc Html.RadioButtonFor

时间:2010-07-14 09:06:58

标签: .net asp.net asp.net-mvc

如何设置selected = true并禁用此单选按钮

<%= Html.RadioButtonFor(m =>m.AddToLevel ,new {id = "rdSameas" }) %>

2 个答案:

答案 0 :(得分:7)

第二个参数是所选的值true

<%= Html.RadioButtonFor(m => m.AddToLevel, true, new { id = "rdSameas", disabled = "disabled"}) %>

答案 1 :(得分:0)

<%= Html.RadioButtonFor(m =>m.AddToLevel ,new {id = "rdSameas", checked = "checked",  disabled = "disabled" }) %>