views:

45

answers:

2

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?

+2  A: 

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")%>
JustinStolle
+1  A: 

It need same name like this

<input  type='radio' name='Rd1' value='true' />

<input  type='radio' name='Rd1'  value='false'/>
Pankaj