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

前端 未结 14 2135
一向
一向 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:01

    I assume you should have a group of radio buttons. something could be like

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

    You may give the default value for m.Gender = "Unknown" (or something) from your controller.

提交回复
热议问题