当我单击编辑按钮时,表单填充文本框中的数据库值以及下拉列表..
文本框值已设置。但我无法设置下拉列表值..
代码是;
SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
con.Open();
string str = "Select * from Master where Id='" + id + "'";
SqlCommand command = new SqlCommand(str, con);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
ddCustomerName.DataValueField = reader["CustomerId"].ToString();
txtPickupLocation.Text = reader["Location"].ToString();
}
con.Close();