title: Radio Buttons in Editor Template
body: <p>I am in the process of creating a 'Progress Report' with a list of questions and multiple choice answers.  The questions are populated into the Progress Report automatically via a separate unrelated process in case it is relevant.</p>
  
  <p>Code is as follows:
  Edit View:</p>
  
  <pre><code>@model App.Models.ProgressReport
  @Html.EditorFor(model =&gt; model.ReportAnswers)
  </code></pre>
  
  <p>ReportAnswer.cshtml EditorTemplate (which shows the question and the answer from the Progress Report):</p>
  
  <pre><code>@model App.Models.ReportAnswer    
  &lt;h3&gt;
      Question
  &lt;/h3&gt;
  
  &lt;p&gt;
      @Html.DisplayFor(x =&gt; x.Question.QuestionText)
  &lt;/p&gt;
  &lt;p&gt;
      @Html.EditorFor(x =&gt; x.Question.PossibleAnswers)
  &lt;/p&gt;
  &lt;p&gt;
      @Html.LabelFor(x =&gt; x.AnswerID)
      @Html.TextBoxFor(x =&gt; x.AnswerID)
  &lt;/p&gt;
  </code></pre>
  
  <p>PossibleAnswer.cshtml (Editor Template which shows all available answers to the question):</p>
  
  <pre><code>@model App.Models.PossibleAnswer
  
  &lt;p&gt;
      @Html.DisplayFor(x =&gt; x.AnswerText)
      @Html.RadioButtonFor(x =&gt; x.AnswerText, Model.AnswerID,  new { Name =Model.QuestionID })
  &lt;/p&gt;
  </code></pre>
  
  <p>So this displays all associated questions from the Progress Report and the optional answers.  </p>
  
  <p>My problems:</p>
  
  <p>1.)  Is that each radio button has a different name which allows me to select all answers for a single question instead of unselecting one as the next is selected. </p>
  
  <p>2.)  The selected answer should load as selected the next time I edit the progress report.  How to have one of the answers pre-selected on load based on the answer provided the last time the view was loaded.</p>
  
  <p>3.)  How to return the selected answer back to the Edit action in my ProgressReport Controller?</p>
  
  <p>Thanks a bunch for any assistance</p>
  
  <p>EditController Code:</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Edit([Bind(Include =  "ReportID,ClientID,ReportDateSubmitted,ReportWeek")] ProgressReport progressReport)
      {
          if (ModelState.IsValid)
          {
              db.Entry(progressReport).State = EntityState.Modified;
              db.SaveChanges();
              return RedirectToAction("Index");
          }
          ViewBag.ClientID = new SelectList(db.Clients, "ClientID", "ID", progressReport.ClientID);
          return View(progressReport);
      }
  </code></pre>