protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { string dataKey = GridView1.DataKeys[e.RowIndex].Value.ToString(); string name = (GridView1.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox).Text; string hanhTrinh = (GridView1.Rows[e.RowIndex].Cells[3].Controls[0] as TextBox).Text; int soNgay = Convert.ToInt16((GridView1.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox).Text); double giaDiLai =Convert.ToDouble((GridView1.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox).Text); double giaAno = Convert.ToDouble((GridView1.Rows[e.RowIndex].Cells[6].Controls[0] as TextBox).Text); string thongTin = (GridView1.Rows[e.RowIndex].Cells[7].Controls[0] as TextBox).Text; string trangThai = (GridView1.Rows[e.RowIndex].Cells[8].Controls[0] as TextBox).Text; DateTime ngayDi = Convert.ToDateTime((GridView1.Rows[e.RowIndex].Cells[9].Controls[0] as TextBox).Text); DateTime ngayVe = Convert.ToDateTime((GridView1.Rows[e.RowIndex].Cells[10].Controls[0] as TextBox).Text); var s = tk.Update(dataKey); s.IdTour = ID; s.TenTour = name; s.HanhTrinh = hanhTrinh; s.SoNgay = soNgay; s.GiaDiLai = giaDiLai; s.GiaPhong = giaAno; s.ThongTin = thongTin; s.TrangThai = trangThai; s.NgayDi = ngayDi; s.NgayVe = ngayVe; tk.SubmitChange(); GridView1.EditIndex = -1; GridView1.DataSource = tk.GetAllTour(); GridView1.DataBind(); }