Example #1
0
		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)
			{
				ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations();
				clsProductGroupVariation.Delete(Convert.ToInt16(lblGroupID.Text),stIDs.Substring(0,stIDs.Length-1));
				clsProductGroupVariation.CommitAndDispose();
			}

			return boRetValue;
		}
Example #2
0
        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");

            switch (e.CommandName)
            {
                case "imgItemDelete":
                    ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations();
                    clsProductGroupVariation.Delete(int.Parse(lblGroupID.Text), chkList.Value);
                    clsProductGroupVariation.CommitAndDispose();

                    Response.Redirect(lblReferrer.Text);
                    break;
                case "imgItemEdit":
                    stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID) + "&groupid=" + Common.Encrypt(lblGroupID.Text, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
            }
        }