Reputation: 267370
I need to display 2 radio buttons horizontally, where the user can only have 1 selected at a time.
Html.Radiobutton
doesn't seem to group items together.
how can this be achieved?
Upvotes: 0
Views: 289
Reputation: 4503
It need same name like this
<input type='radio' name='Rd1' value='true' />
<input type='radio' name='Rd1' value='false'/>
Upvotes: 1
Reputation: 4460
The radio buttons need to have the same name, but use a different value.
<%= Html.RadioButton("myRadioButton", "yes")%>
<%= Html.RadioButton("myRadioButton", "no")%>
<%= Html.RadioButton("myRadioButton", "neither")%>
Upvotes: 2