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) { ProductVariations clsProductVariation = new ProductVariations(); clsProductVariation.Delete(Convert.ToInt16(lblProductID.Text),stIDs.Substring(0,stIDs.Length-1)); clsProductVariation.CommitAndDispose(); } return boRetValue; }