protected void btnDelete_Click(object sender, EventArgs e) { ArrayList ar = new ArrayList(); foreach (DataGridItem m_Item in dgrListAppro.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { ar.Add(double.Parse(dgrListAppro.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString())); } } if (ar.Count > 0) { for (int i = 0; i < ar.Count; i++) { int _ID = int.Parse(ar[i].ToString()); HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL(); _DAL.DeleteFromT_Logo(_ID); } } else { System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Chưa chọn ảnh muốn xóa.!!')", true); return; } LoadDataApprovied(); }
public void dgrListAppro_EditCommand(object source, DataGridCommandEventArgs e) { if (e.CommandArgument.ToString().ToLower() == "edit") { dgrListAppro.EditItemIndex = e.Item.ItemIndex; LoadDataApprovied(); } if (e.CommandArgument.ToString().ToLower() == "delete") { HPCBusinessLogic.DAL.T_LogoDAL _DAL = new HPCBusinessLogic.DAL.T_LogoDAL(); int _ID = Convert.ToInt32(dgrListAppro.DataKeys[e.Item.ItemIndex].ToString()); _DAL.DeleteFromT_Logo(_ID); LoadDataApprovied(); } }