private void BindgvCollecingDetails(int productID) { lblBatchID.Text = string.Empty; List <string> selectedValues = chkICSListInner.Items.Cast <ListItem>() .Where(li => li.Selected) .Select(li => "'" + li.Value + "'") .ToList(); string chkSelectedVal = string.Empty; if (selectedValues.Count > 0) { chkSelectedVal = string.Join(",", selectedValues.ToArray()); } if (selectedValues.Count > 0) { chkSelectedVal = string.Join(",", selectedValues.ToArray()); } List <string> selectedVillageValues = chkVillageist.Items.Cast <ListItem>() .Where(li => li.Selected) .Select(li => "'" + li.Value + "'") .ToList(); string selectedVillageValue = string.Empty; if (selectedVillageValues.Count > 0) { selectedVillageValue = string.Join(",", selectedVillageValues.ToArray()); } DataTable Pyear = new DataTable(); DataTable dtBranchOrder = new DataTable(); DataTable dtDate = new DataTable(); DataTable dtOrderCollect = new DataTable(); if (productID == 4 || productID == 10 || productID == 11) { if (productID == 4) { dtDate = settObj.GetStandDetails("2", (DateTime.Now.Year - 1).ToString()); } if (productID == 10) { dtDate = settObj.GetStandDetails("3", (DateTime.Now.Year - 1).ToString()); } if (productID == 11) { dtDate = settObj.GetStandDetails("8", (DateTime.Now.Year - 1).ToString()); } } else { dtDate = settObj.GetStandDetails(productID.ToString(), (DateTime.Now.Year - 1).ToString()); } if (dtDate.Rows.Count > 0) { Pyear = settObj.GetProductionYear(Convert.ToDateTime(dtDate.Rows[0]["Date"].ToString())); } //divgvCollectDetails.Visible = true; if (Pyear.Rows.Count > 0) { dtOrderCollect = orderObj.CollectedProductDetailsBasedonProductandICs(productID, Pyear.Rows[0]["ProductionYear"].ToString(), selectedVillageValue); //DataTable dtOrderCollect = orderObj.CollectedProductDetailsBasedonProductandICsNew(productID, chkSelectedVal); if (dtOrderCollect.Rows.Count > 0) { trCollect.Visible = true; trProductName.Visible = true; divgvCollectDetails.Visible = true; gvCollecingDetails.DataSource = dtOrderCollect; gvCollecingDetails.DataBind(); btncollectSubmit.Enabled = true; btnGenerateBatchID.Visible = true; } } }