Example #1
0
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstStuff.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();
				clsPromoBySupplierItems.Delete(stIDs.Substring(0,stIDs.Length-1));
				clsPromoBySupplierItems.CommitAndDispose();
			}

			return boRetValue;
		}
Example #2
0
        protected void lstStuff_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");

            switch (e.CommandName)
            {
                case "imgItemDelete":
                    {
                        PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();
                        clsPromoBySupplierItems.Delete(chkList.Value);
                        clsPromoBySupplierItems.CommitAndDispose();
                        LoadList();
                    }
                    break;

            }
        }