sunny kumar

sunny kumar

  • NA
  • 333
  • 9.4k

Show default value in dropdown list from database

Jan 31 2019 11:20 PM
I am saving dropdown list values to database , but when i am trying to retrieve the value saved in the database to dropdown, the dropdown default value shows different value
 
using (SqlConnection con = new SqlConnection(st))
{
con.Open();
SqlCommand cmd = new SqlCommand("spGetUploadedImage", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@PId", Convert.ToInt32(ddproject.SelectedValue.ToString()));
SqlDataReader rd = cmd.ExecuteReader();
if (rd.Read())
{
txtuserdomain.Text = rd["P_user_domain"].ToString();
txtawards.Text = rd["P_awards"].ToString();
txtcoverage.Text = rd["P_functional_coverage"].ToString();
txtfeatures.Text = rd["P_feature"].ToString();
txtimplementation.Text = rd["P_implementation"].ToString();
ddimportance.DataValueField = rd["Importance"].ToString();
}
 

Answers (13)