protected void Page_Load(object sender, EventArgs e) { GridView1.DataSource = tk.GetAllTour(); GridView1.DataBind(); DropDownList1.DataSource = tk.GetAllTour(); DropDownList1.DataValueField = "IdTour"; DropDownList1.DataTextField = "TenTour"; DropDownList1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { //string s = @"Data Source=DESKTOP-0RP6AU8\SQLEXPRESS;Initial Catalog=QLDuLich;Integrated Security=True"; //SqlConnection cnn = new SqlConnection(s); //string query = "Select*" + // "from Tour"; //SqlDataAdapter da = new SqlDataAdapter(query, cnn); //DataTable dt = new DataTable(); //cnn.Open(); //da.Fill(dt); //cnn.Close(); GridView1.DataSource = tk.GetAllTour(); GridView1.DataBind(); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridView1.DataSource = tk.GetAllTour(); }