SRA
SRA

Reputation: 1691

disable and select asp.net mvc Html.RadioButtonFor

How can i set selected = true and disable this radio button

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

Upvotes: 4

Views: 8095

Answers (2)

Yakimych
Yakimych

Reputation: 17752

The second parameter is the value: true for selected:

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

Upvotes: 8

Simon Hazelton
Simon Hazelton

Reputation: 1255

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

Upvotes: 0

Related Questions