title: Razor - Radio Button To Be Checked in a Foreach Loop
body: <p>I have a radio button in a foreach loop within a form to be posted. I want the first one to be checked when they are listed. <code>checked = "checked"</code> below doesn't help. It only works if there is a  single radio button. </p>
  
  <pre><code>&lt;form action="/logged/hotel" method="post" &gt;
      @foreach (var item in ViewBag.companies)
      {
         &lt;input type="radio" name="graph" value="@item.Value" checked="checked" /&gt; @item.Text&lt;br /&gt;
      }
      &lt;input type="submit" value ="LOG IN" /&gt;
  &lt;/form&gt;
  </code></pre>