title: SelectedItem of DropDown in asp.net always shows the same value no matter what is selected
body: <p>I have a dropdownlist control of asp.net.I want to track the item selected in the dropdownlist. Let me show what i have done.</p>
  
  <p>This is DropdownList control:</p>
  
  <pre><code>&lt;asp:DropDownList ID="Dd_Cat" runat="server" 
           DataValueField="CatId" DataTextField="CatName" 
           OnSelectedIndexChanged="wtf"  &gt;
  &lt;/asp:DropDownList&gt;
  </code></pre>
  
  <p>This is the code behind used to populate the <code>dropdownlist</code> from database.</p>
  
  <pre><code>protected void bindDropdown()
  {
     string mystr = ConfigurationManager.ConnectionStrings["str"].ConnectionString;
     SqlConnection con = new SqlConnection(mystr);
     con.Open();
     SqlCommand cmd = new SqlCommand("AddCat", con);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.AddWithValue("@action", "select");
     SqlDataAdapter da = new SqlDataAdapter(cmd);
     DataSet ds = new DataSet();
     da.Fill(ds);
     Dd_Cat.DataSource = ds;
     Dd_Cat.DataBind();
     con.Close();
     con.Dispose();
  }
  </code></pre>
  
  <p>The <code>onselected</code> property of <code>dropdownlist</code> control:</p>
  
  <pre><code>protected void wtf(object sender, EventArgs e)
  {
    string st = Dd_Cat.SelectedValue;
  }
  </code></pre>
  
  <p>This always show the value "1" nomatter what is selected.Please help.</p>