title: Selected property in SelectListItem never works (DropDownListFor)
body: <p>I have problems when selecting a value of a DropDownList. I've been reading all the similar posts and I can't get a solution.</p>
  
  <p>The actual approach seemed very good to me, because I can inspect the fields that will be inside the SelectList:</p>
  
  <pre><code>var selectList = new List&lt;SelectListItem&gt;(
      from variable in someKindOfCollection
      select new SelectListItem
          {
              Selected = variable.Property == selection,
              Text = variable.Property,
              Value = variable.Property
          });
  </code></pre>
  
  <p>Supposedly, this gives me total control. After the selectList has been built I can inspect the variables with the debugger. Everything is OK and one of them has the "Selected" attribute marked.</p>
  
  <p>Then I use DropDownListFor in order to show on the view:</p>
  
  <pre><code>@Html.DropDownListFor(
      g =&gt; g.SomePropertyInModel , selectList, new { @class = "cssClass" })
  </code></pre>
  
  <p>But It doesn't work, never... "Renders" the dropdown, but nothing is selected.</p>
  
  <p>Thanks a lot :)</p>
  
  <p><strong>NEW EXAMPLE
  First of all I want to apologize. I've been hiding information, of course totally unintentionally.
  All the code happens inside a Razor For Loop:</strong></p>
  
  <pre><code>@foreach (var loopVariable in Model.Collection)
  {
      if (Model.SomeCondition != null)
      {
          selection = someValue;
      }
  
      var selectList = new List&lt;SelectListItem&gt;(
        from variable in someKindOfCollection
        select new SelectListItem
      {
          Selected = variable.Property == selection,
          Text = variable.Property,
          Value = variable.Property
      });
  
      @Html.DropDownListFor(
          g =&gt; g.SomePropertyInModel , selectList, new { @class = "cssClass" })
  
  }
  </code></pre>
  
  <p>So, It's the fact of selectList is a local variable causing the behavior?. Sorry, I didn't thought it was that.</p>