title: mvc populate dropdownlist from ienumerable model
body: <p>I have to populate <strong>distinct</strong> company name in Dropdownlistfor from </p>
  
  <pre><code>@model IEnumerable&lt;Zykod.Data.Models.CUtilityModel&gt;
  </code></pre>
  
  <p>I tried the following ways.  Nothing is working.</p>
  
  <pre><code>@Html.DropDownListFor(Model.Select(i =&gt; i.CompanyName).Distinct().ToList(), new List&lt;SelectListItem&gt;(), new { @class = "input-large form-control" })
  
  @Html.DropDownList("CompanyName", new SelectList(Model).Distinct())
  
  @Html.DropDownListFor(model =&gt; model.CompanyName, new List&lt;SelectListItem&gt;(), new { @class = "input-large form-control" })
  </code></pre>