public void grdListAdsPos_EditCommand(object source, DataGridCommandEventArgs e) { AdsPosDAL obj_Cate = new AdsPosDAL(); if (e.CommandArgument.ToString().ToLower() == "edit") { int catID = Convert.ToInt32(this.grdListAdsPos.DataKeys[e.Item.ItemIndex].ToString()); Response.Redirect("~/Quangcao/AdsPosEdit.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + catID); } if (e.CommandArgument.ToString().ToLower() == "delete") { obj_Cate.DeleteFromT_AdsPosByID(Convert.ToInt32(this.grdListAdsPos.DataKeys[e.Item.ItemIndex].ToString())); this.LoadData(); } }
protected void btnLinkDelete_Click(object sender, EventArgs e) { foreach (DataGridItem m_Item in grdListAdsPos.Items) { CheckBox chk_Select = (CheckBox)m_Item.FindControl("optSelect"); if (chk_Select != null && chk_Select.Checked) { LinkButton linkname = (LinkButton)m_Item.FindControl("Linkvitri"); int _ID = int.Parse(grdListAdsPos.DataKeys[int.Parse(m_Item.ItemIndex.ToString())].ToString()); AdsPosDAL objAdsPosDAL = new AdsPosDAL(); objAdsPosDAL.DeleteFromT_AdsPosByID(_ID); //WriteLogHistory2Database.WriteHistory2Database(_user.UserID, _user.UserFullName, linkname.Text, //Request["Menu_ID"].ToString(), "[Danh sách vị trí]-->[Thao tác xóa vị trí]ID:" + _ID.ToString() + " ]", 0); } } LoadData(); }