title: MVC html.dropdownlist display selected value after postback
body: <p>I have an html.dropdownlist that is being populated in the Index action.</p>
  
  <pre><code>    public ActionResult Index()
      {
          var maxyear = (from estiamte in dbBudget.Estimates
                         select estiamte.Year).Max();
  
          var years = (from estimate in dbBudget.Estimates
                       select new { estimate.Year }).Distinct().ToList();
  
          ViewData["Years"] = new SelectList(years.OrderByDescending(o =&gt; o.Year), "Year", "Year");
  
          var vu_Estimates = dbBudget.vu_Estimates.OrderByDescending(o =&gt; o.Expense).ThenBy(o =&gt; o.CategoryGroupSortOrder).ThenBy(o =&gt; o.SortOrder).Where(o =&gt; o.Year == maxyear).ToList();
  
          return View(vu_Estimates);
      }
  </code></pre>
  
  <p>I'm defining the html.dropdownlist so that changing the value will trigger a postback:</p>
  
  <pre><code>&lt;div&gt;
      &lt;% using (Html.BeginForm()) { %&gt;
          &lt;%= Html.DropDownList("Years", (SelectList)ViewData["Years"], new { onchange = "this.form.submit();" })%&gt; | &lt;%: Html.ActionLink("Create New Year of Estimates", "CreateEstimates", "Estimate") %&gt;
      &lt;%} %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm capturing the postback and filtering the displayed table.  I'm trying to have the dropdown list display the chosen value, but that is not working.</p>
  
  <pre><code>    [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Index(FormCollection formCollection)
      {
          var years = (from estimate in dbBudget.Estimates
                       select new { estimate.Year }).Distinct().ToList();
  
          int year = Convert.ToInt32(formCollection["Years"]);
  
          ViewData["Years"] = new SelectList(years.OrderByDescending(o =&gt; o.Year), "Year", "Year", year);
  
          var vu_Estimates = dbBudget.vu_Estimates.OrderByDescending(o =&gt; o.Expense).ThenBy(o =&gt; o.CategoryGroupSortOrder).ThenBy(o =&gt; o.SortOrder).Where(o =&gt; o.Year == year).ToList();
  
          return View(vu_Estimates);
      }
  </code></pre>
  
  <p>What do I need to do to have the dropdown list display the selected value after postback instead of the first value in the list?</p>