title: Restore a drop down selected item after postback
body: <p>I'm trying to refresh page when an item of the drop down list is selected.</p>
  <p>DropDownList never gets last selected item, it always restores the one which is saved in ViewState. ViewState doesn't want to remember new stuff, it always keeps one and the same info.</p>
  <p><strong>DEFAULT ASPX PAGE</strong></p>
  <pre><code>&lt;%@ Page Language=&quot;C#&quot; MasterPageFile=&quot;~/MasterPage.master&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;ExperimentalPage.aspx.cs&quot; 
  Inherits=&quot;ExperimentalPage&quot; Title=&quot;Enperimental Page&quot; EnableViewState=&quot;True&quot; %&gt;
  
  &lt;asp:Content ID=&quot;ExperimentalLeftPane&quot; ContentPlaceHolderID=&quot;cph_LeftPane&quot; Runat=&quot;Server&quot;&gt;  
      &lt;div style=&quot;position: absolute; left: 0px; top: 35px; width: 250px;&quot;&gt;
          &lt;asp:DropDownList ID=&quot;dd1&quot; runat=&quot;server&quot; OnSelectedIndexChanged=&quot;RefreshPage&quot; AutoPostBack=&quot;True&quot; CssClass=&quot;class_DropDown&quot; Style=&quot;width: 250px; margin-bottom: 3px;&quot;/&gt;
      &lt;/div&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  <p><strong>DEFAULT ASPX.CS CODE-BEHIND PAGE</strong></p>
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!Page.IsPostBack)
      {
          dd1.Items.Insert(0, &quot;dd1-0&quot;);
          dd1.Items[0].Value = &quot;0&quot;;
          dd1.Items.Insert(1, &quot;dd1-1&quot;);
          dd1.Items[1].Value = &quot;1&quot;;
          dd1.Items.Insert(2, &quot;dd1-2&quot;);
          dd1.Items[2].Value = &quot;2&quot;;
      }
      else        
      {
          dd1.SelectedIndex = dd1.Items.IndexOf(dd1.Items.FindByValue(Convert.ToString(Request.QueryString[&quot;dd1&quot;])));
      }
  }
  
  protected void RefreshPage(object o, EventArgs e)
  {
      Page.Response.Redirect(&quot;ExperimentalPage.aspx?&quot;
      + &quot;&amp;dd1=&quot; + dd1.SelectedValue);
  }
  </code></pre>
  <p><strong>THE PROBLEM PARTIALLY RESOLVED</strong></p>
  <p><em>See my answer</em></p>