I have a radio button list like this:
<%=Html.RadioButtonFor(m => m.Gender,"Male")%>
I want this button selected by default. How do I do this?
<%: Html.RadioButtonFor(x => x.Gender, "Male", new { @checked = "checked" }) %>
or in the controller action that renders this view:
model.Gender = "Male";
return View(model);
if u are using Razor view strong you can use use radio button like this
@Html.RadioButtonFor(model => model.PrintOrder, "Sequential", new {@checked="true"}) Sequential
as your need correct it as Razor view
@Html.RadioButtonFor(x => x.Gender, "Male", new { @checked = "checked" })
Aspx view
<%: Html.RadioButtonFor(x => x.Gender, "Male", new { @checked = "checked" }) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With