title: mvc3 Html.DropDownListFor - dynamically create "value" attribute in <option>
body: <p>I am trying to dynamically generate the "value" attribute of the  tag using the HTML.DropDownListFor, but I am running into issues.  I am thinking of just hard-coding a for-loop and inserting raw HTML, but I am positive there is an easier way to do this (?)</p>
  
  <p>I have a view model:</p>
  
  <pre><code>    public class DSDCustomerViewModel
          {
              public IEnumerable&lt;dsd_l_chain&gt; chainBuild { get; set; }
              public string Id_dsd { get; set; }
              public string Owner { get; set; }
              public IEnumerable&lt;string&gt; WFCategory { get; set; }
              public IEnumerable&lt;string&gt; TransactionType { get; set; } 
  [etc etc etc]
  </code></pre>
  
  <p>the chainBuild property comes from my database (using EF) that I fill using an extension method for my view as follows:</p>
  
  <pre><code>@using (Html.BeginForm())
  {
      @Html.ValidationSummary(true)
      &lt;table&gt;
          &lt;tbody&gt;
  [etc etc]
  &lt;td colspan="1" rowspan="1"&gt;
                      Chain Name
                  &lt;/td&gt;
                  &lt;td colspan="1" style="vertical-align: top;"&gt;
                      @Html.DropDownListFor(model =&gt; model.cc_chainName, new SelectList(Model.cc_chainName), "Select ...")
                  &lt;/td&gt;
                  &lt;td rowspan="1" colspan="2" style="vertical-align: top;"&gt;
                      @Html.ValidationMessageFor(model =&gt; model.cc_chainName)
                  &lt;/td&gt;
  [etc etc]
  </code></pre>
  
  <p>the cc_chainName EF object has the attributes "Chain_Desc", "Chain", "Chain_Group" and "ID" among others. </p>
  
  <p>The generated HTML is as follows:</p>
  
  <pre><code>&lt;select id="cc_chainName" name="cc_chainName"&gt;&lt;option value=""&gt;Select ...&lt;/option&gt;
  &lt;option&gt;1ST STOP&lt;/option&gt;
  &lt;option&gt;3 RIVERS ICE CREAM SPCLTS&lt;/option&gt;
  &lt;option&gt;3RIVERS SALES TO NON-NAP CUSTS&lt;/option&gt;
  </code></pre>
  
  <p>How do I modify:</p>
  
  <pre><code>@Html.DropDownListFor(model =&gt; model.cc_chainName, new SelectList(Model.cc_chainName), "Select ...")
  </code></pre>
  
  <p>...so that the generated HTML code set the "value" attribute of the  tag to cc_chainName.ID? so that the generated HTML would look like this:</p>
  
  <pre><code>&lt;select id="cc_chainName" name="cc_chainName"&gt;&lt;option value=""&gt;Select ...&lt;/option&gt;
  &lt;option value="1"&gt;1ST STOP&lt;/option&gt;
  &lt;option value="2"&gt;3 RIVERS ICE CREAM SPCLTS&lt;/option&gt;
  &lt;option value="3"&gt;3RIVERS SALES TO NON-NAP CUSTS&lt;/option&gt;
  </code></pre>
  
  <p>note the "value" tags contain the IDs from the cc_chainName model</p>
  
  <p>Thanks!</p>