DropDownList
ผมต้องการดึงข้อมูลจากฐานข้อมูลมาแสดงใน DrowDownList นะคับให้ index ที่ 0 แสดง คำว่า โปรเลือก แล้ว index ที่ 1 เป็นต้นไปให้แสดงข้อมุลในฐานข้อมูลนะคับ ผมทำอย่างนี้มันไม่ได้นะคับ string sqlc = "Select * From Customer"; SqlDataAdapter adapc = new SqlDataAdapter(sqlc, conn); adapc.Fill(dset, "cus"); ddl_customer.DataValueField = "Cus_Fname"; ddl_customer.DataTextField = "Cus_Fname"; ddl_customer.DataSource = dset.Tables["cus"]; ddl_customer.DataBind(); ddl_customer.SelectedIndex = -1;
|