當我點擊編輯按鈕表格填充文本框中的數據庫值以及下拉列表..如何在編輯中將下拉列表值和項目設置爲數據庫表格值?
設置文本框的值。但我無法設置下拉列表值。
代碼是;
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();
嚴其工作... – Saranya 2013-05-06 06:40:18
好...投票,如果它的工作:) – 2013-05-06 06:43:25