title: How to SELECT a drop down list item by value programatically in C# and pass it to integer?
body: <pre><code>   public DataTable selectcat(int catid)
  {
      SqlConnection con = new SqlConnection(DBHelper.connection);
      SqlCommand com = new SqlCommand();
      com.Connection = con;
      con.Open();
      com.CommandType = CommandType.StoredProcedure;
      com.CommandText = "selectcatalog";
      com.Parameters.AddWithValue("@catid", catid);
      SqlDataReader dr = com.ExecuteReader();
      DataTable dt = new DataTable();  
          dt.Load(dr);
          con.Close();
          return dt;
  }
  </code></pre>
  
  <p>then i call the function in dropdownlist event (SelectedIndexChanged)</p>
  
  <pre><code> protected void catselectddl_SelectedIndexChanged(object sender, EventArgs e)
  {
     DataTable dt;
  
      DAcatagory obj = new DAcatagory();
      dt = obj.selectcat(catselectddl.SelectedValue);
      DataRow dr = dt.Rows[0];
      catnametxt.Text = dr["catname"].ToString();
      catdestxt.Text = dr["catdescription"].ToString();
  }
  </code></pre>
  
  <p>but it give me invalid arguments error at <code>dt = obj.selectcat(catselectddl.SelectedValue);</code>
  PS: the dropdownlist take his display and the value from database</p>