protected void grDSTheLoai_RowDeleting(object sender, GridViewDeleteEventArgs e) { TheLoaiSumDAO tlsumdao = new TheLoaiSumDAO(); int ma=int.Parse(grDSTheLoai.DataKeys[e.RowIndex].Value.ToString()); tlsumdao.Xoa(ma); loadGR(); }
protected void grDSTheLoai_RowDeleting(object sender, GridViewDeleteEventArgs e) { TheLoaiSumDAO tlsumdao = new TheLoaiSumDAO(); int ma = int.Parse(grDSTheLoai.DataKeys[e.RowIndex].Value.ToString()); tlsumdao.Xoa(ma); loadGR(); }
protected void grDSTheLoai_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = grDSTheLoai.Rows[e.RowIndex]; TextBox text = row.Cells[1].Controls[0] as TextBox; int ma = Int32.Parse(grDSTheLoai.DataKeys[e.RowIndex].Value.ToString()); string tenmoi = text.Text; TheLoaiSumDAO tldao = new TheLoaiSumDAO(); bool kq= tldao.CapNhat(ma, tenmoi); if (kq == true) { e.Cancel = true; grDSTheLoai.EditIndex = -1; loadGR(); } else lblThongBao.Text = "Fail!"; }
protected void grDSTheLoai_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = grDSTheLoai.Rows[e.RowIndex]; TextBox text = row.Cells[1].Controls[0] as TextBox; int ma = Int32.Parse(grDSTheLoai.DataKeys[e.RowIndex].Value.ToString()); string tenmoi = text.Text; TheLoaiSumDAO tldao = new TheLoaiSumDAO(); bool kq = tldao.CapNhat(ma, tenmoi); if (kq == true) { e.Cancel = true; grDSTheLoai.EditIndex = -1; loadGR(); } else { lblThongBao.Text = "Fail!"; } }