protected void grvContact_RowDeleting(object sender, GridViewDeleteEventArgs e) { int Id = Convert.ToInt32(grvContact.DataKeys[e.RowIndex].Value); BContact obj = new BContact(); if (obj.Delete(Id)) { lblThongBao2.Text = "BẠN ĐÃ XÓA THÀNH CÔNG DANH BẠ!"; } grvContact_Load(); }
protected void btnXoa_Click(object sender, EventArgs e) { BContact obj = new BContact(); foreach (GridViewRow row in grvContact.Rows) { CheckBox checkbox = (CheckBox)row.FindControl("MyCheckBox"); if (checkbox.Checked == true) { int Id = Convert.ToInt32(grvContact.DataKeys[row.RowIndex].Value); obj.Delete(Id); lblThongBao2.Text = "BẠN ĐÃ XÓA THÀNH CÔNG DANH BẠ!"; } } grvContact_Load(); }