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

前端 未结 14 1868
一向
一向 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 21:54

    If you're using jquery, you can call this right before your radio buttons.

    $('input:radio:first').attr('checked', true);
    

    ^ This will check the first radio box, but you can look at more jquery to cycle through to the one you want selected.

提交回复
热议问题