How to Set RadioButtonFor() in ASp.net MVC 2 as Checked by default

前端 未结 14 1863
一向
一向 2021-02-06 21:20

How can i Set RadioButtonFor() as Checked By Default

<%=Html.RadioButtonFor(m => m.Gender,\"Male\")%>

there is way out for (Html.Radio

相关标签:
14条回答
  • 2021-02-06 22:03

    Use the simple way:

    <%= Html.RadioButtonFor(m => m.Gender, "Male", new { Checked = "checked" })%>
    
    0 讨论(0)
  • 2021-02-06 22:04

    This question on StackOverflow deals with RadioButtonListFor and the answer addresses your question too. You can set the selected property in the RadioButtonListViewModel.

    0 讨论(0)
提交回复
热议问题