I am looking at some printable questions on the page. Each question requires 5 radio buttons with numbers from 0 to 5.
They currently work as expected (if a little rude) For example:
<table>
<tr>
@for (int i = 0; i < Model.Questions.Count; i++)
{ <td style="width:80px; padding-left: 10px;">
<label for="q1-0" class="rblBreq">@Html.RadioButtonFor(m => m.PatientQuestions[i].Answer, "0") 0</label>
</td>
@*middle*@
<td style="width:80px; padding-left: 10px;">
<label for="q1-1" class="rblBreq">@Html.RadioButtonFor(m => m.PatientQuestions[i].Answer, "1") 1</label>
</td>
<td style="width:80px; padding-left: 10px;">
<label for="q1-2" class="rblBreq">@Html.RadioButtonFor(m => m.PatientQuestions[i].Answer, "2") 2</label>
</td>
<td style="width:80px; padding-left: 10px;">
<label for="q1-3" class="rblBreq">@Html.RadioButtonFor(m => m.PatientQuestions[i].Answer, "3") 3</label>
</td>
@*last*@
<td style="width:80px; padding-left: 10px;">
<label for="q1-4" class="rblBreq">@Html.RadioButtonFor(m => m.PatientQuestions[i].Answer, "4") 4</label>
</td>
</tr>
}
</table>
What I'm trying to do is add a style similar to cssCheckBox.com
However, when I try to use this example, grouping no longer works, for example. pressing checkbox_2, checkbox_3or checkbox_1always causes checkbox_0 checked...
I tried using (mvc) LabelFor, but this will not work, assuming id, etc. same in all flags.
<td style="width:80px; padding-left: 10px;">
@Html.RadioButtonFor(m => m.PatientQuestions[i].Answer, "1", new { @class = "css-checkbox" })
@Html.LabelFor(m => m.PatientQuestions[i].Answer, "1", new { @class = "css-label" })
</td>
Any idea on how to get a style / grouping that works with a list of radio buttons would be great.