Disable and select ASP.NET MVC HTML.Radiobuttonfor

How to set selected = true and disable this radio button

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

The second parameter is selected Value: true:

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

How to set selected = true and disable this radio button

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

The second parameter is the selected value: true:

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

Leave a Comment

Your email address will not be published.