RadioButtonFor in ASP.NET MVC 2

后端 未结 2 1415
北海茫月
北海茫月 2021-01-04 03:48

Can someone provide a simple example of how to properly use Html.RadioButtonFor? Let\'s say it\'s a simple scenario where my model has a string property named Gender. I wa

相关标签:
2条回答
  • 2021-01-04 04:15
    Male: <%= Html.RadioButtonFor(x => x.Gender, "Male") %>
    Female: <%= Html.RadioButtonFor(x => x.Gender, "Female") %>
    
    0 讨论(0)
  • 2021-01-04 04:32

    This question on StackOverflow deals with RadioButtonListFor and the answer addresses your question too (@Larsenal it also includes labels with the "for" attribute)

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