private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { ProductSubGroup clsProductSubGroup = new ProductSubGroup(); clsProductSubGroup.Delete( stIDs.Substring(0,stIDs.Length-1)); clsProductSubGroup.CommitAndDispose(); } return boRetValue; }
protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { HtmlInputCheckBox chkList = null; string stParam = string.Empty; chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&subgroupid=" + Common.Encrypt(chkList.Value, Session.SessionID); switch (e.CommandName) { case "imgItemDelete": ProductSubGroup clsProductSubGroup = new ProductSubGroup(); clsProductSubGroup.Delete(chkList.Value); clsProductSubGroup.CommitAndDispose(); LoadList(); break; case "imgItemEdit": stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; case "imgVariationsClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_Variations/Default.aspx" + stParam); break; case "imgVariationsMatrixClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_VariationsMatrix/Default.aspx" + stParam); break; case "imgUnitsMatrixClick": Response.Redirect(Constants.ROOT_DIRECTORY + "/MasterFiles/_ProductSubGroup/_UnitsMatrix/Default.aspx" + stParam); break; } }