protected void btnXoa_Click(object sender, EventArgs e) { tlbll.XoaTheLoai(txtMaTheLoai.Text); Page_Load(sender, e); Response.Write("<script language=''javascript>alert('" + " Xóa thành công! " + "')</script>"); txtMaTheLoai.Text = ""; txtTenTheLoai.Text = ""; }
void XoaTheLoai() { string matheloai = dtgvTheLoai.SelectedRows[0].Cells["Mã thể loại"].Value.ToString(); if (MessageBox.Show("Bạn có chắc xóa hãng sản xuất có mã " + matheloai + " không?", "Xóa thể loại", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (theloai.XoaTheLoai(matheloai)) { MessageBox.Show("Xóa thể loại thành công!"); LoadDtgvTheLoai(); } else { MessageBox.Show("Xóa thể loại không thành công!"); } } }