Reputation: 27996
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 ?
Upvotes: 0
Views: 882
Reputation: 8397
Try including a "name" value in the new { @class = "answer " + qOrderedClass, id = "_Q_" + questionOrderedNumber }
, as is always needed when creating radio button groupings.
Upvotes: 1
Reputation: 5719
Does this solve your problem: http://jonlanceley.blogspot.com/2011/06/mvc3-radiobuttonlist-helper.html ?
Upvotes: 0