title: ASP.NET MVC 5 group of radio buttons
body: <p>I am starting my first ASP.NET MVC project, so I have one simple question.
  I have following code:</p>
  
  <pre><code>foreach(var question in Model.GeneralQuestions)
  {
      &lt;div class = "well"&gt;
          &lt;h3&gt;
              &lt;strong&gt;@question.QuestionString&lt;/strong&gt;
          &lt;/h3&gt;
          @foreach (var answer in question.PossibleAnswers)
          {
              @Html.RadioButtonFor(model =&gt; question.QuestionString, answer.Answer)
              @Html.Label(answer.Answer)
              &lt;br /&gt;
          }
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>All questions in Model.GeneralQuestions are unique, so radio buttons should be divided into groups by name attribute (for each question one group of radio buttons). But this code produces only one group, so when I answer second question first one becomes deselected.
  What do I need to change?   </p>
  
  <p><strong>EDIT</strong><br>
  My model looks like:</p>
  
  <pre><code>public class StudentViewModel
  {
      public Student Student { get; set; }
      public List&lt;Question&gt; GeneralQuestions { get; set; }
      public List&lt;SubjectQuestions&gt; SubjectQuestions { get; set; }
  }
  public class Student
  {
      public int StudentID { get; set; }
      public string Index { get; set; }
      public string Name { get; set; }
      public string Surname { get; set; }
  
      public virtual ICollection&lt;Subject&gt; Subjects { get; set; }
  }
  public class Question
  {
      public int QuestionID { get; set; }
      public string QuestionString { get; set; }
      public bool IsAssociatedWithSubject { get; set; }
  
      public virtual ICollection&lt;PossibleAnswer&gt; PossibleAnswers { get; set; }
      public virtual ICollection&lt;Results&gt; Results { get; set; }
  }
  public class SubjectQuestions
  {
      public Subject Subject { get; set; }
      public List&lt;Question&gt; Questions { get; set; }
  }
  public class Results
  {
      public int ResultsID { get; set; }
      public int QuestionID { get; set; }
      public int? SubjectID { get; set; }
      public int PossibleAnswerID { get; set; }
  
      public virtual Question Question { get; set; }
      public virtual PossibleAnswer PossibleAnswer { get; set; }
      public virtual Subject Subject { get; set; }
  }
  </code></pre>
  
  <p>In one instance of StudentViewModel I save one student and all questions that he should answer (both general and related to subjects he is studying) and pass it to view. In view I put all questions in single form and they are all type of radio. So, can anyone help me with grouping of radio buttons and posting back this form correctly?</p>