I have created radio button like this:
@foreach (LoanQuestionIncludesStatement statement in item.Statements)
{
_question = statement.Question;
@Html.RadioButton("_Q_" + counter.ToString("0#") + _question.ToString(), false, new { @class = "answer " + qOrderedClass, id = "_Q_" + questionOrderedNumber }) @statement.Statement
@Html.Hidden("_S_" + counter.ToString("0#") + _question.ToString(), statement.KeyOrStatement)
<br />
counter++;
}
but they are not grouped. Mean I can check all the radio buttons. I want one of the radio button from each group to be checked. How to specify groupname ?
Try including a “name” value in the
new { @class = "answer " + qOrderedClass, id = "_Q_" + questionOrderedNumber }, as is always needed when creating radio button groupings.