title: Razor syntax for DropDownListFor
body: <p>How can I write code below with a HTML helper?</p>
  
  <pre><code>&lt;select name="CountryId"&gt;
      @foreach (var c in ViewBag.Counties) {
          &lt;option value="@c.Id"&gt;@c.Name&lt;/option&gt;
      }
  &lt;/select&gt;
  </code></pre>
  
  <p>This code above will give the right html code in my browser. But if I use the HTML helper below the <strong>value attribute</strong> from the option tags are missing. </p>
  
  <pre><code>@Html.DropDownListFor(
      model =&gt; model.CountryId, 
      new SelectList(ViewBag.Countries, "Name"), 
      new { htmlAttributes = new { @class = "form-control" } }
  )
  </code></pre>
  
  <p>What's wrong in this code if you know that <code>ViewBag.Counties</code> is an object from type <code>List&lt;Country&gt;</code> and has the properties <code>Name</code> (type of string) and <code>CounrtyId</code> (type of int).</p>