Reputation: 838
Quite a simple question, but struggling to find an answer for it. How do I convert
<input type="radio" id="radAnswer" name="answer" value="@answer" />
to
@Html.RadioButtonFor(/*some sort of code in here*/)
Thanks in advance!
Upvotes: 1
Views: 627
Reputation: 462
something like
@Html.RadioButtonFor(x => x.answer, your value, new { @id= "radAnswer" , @class="any"})
for new property define in new like for checked radiobutton
new { Checked = "checked"}
Upvotes: 3
Reputation: 2134
You could use RadioButtonFor
as follows
@Html.RadioButtonFor(model => model.answer,"Answer",new { id = "radAnswer" })
Upvotes: 1
Reputation: 1753
I think this question, can help you, it's not the same but give a good understanding of how the @Html.RadioButtonFor
syntax works.
Upvotes: 0