private void FillSalesPromotionDeatailsTogrid() { objHRinfo = new HRInfo(); DataTable dt = new DataTable(); gvSalePromotionDetails.Rows.Clear(); if (cbCompany.SelectedIndex > 0) { try { dt = objHRinfo.GetSalesPromotionDetails(cbCompany.SelectedValue.ToString()).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { gvSalePromotionDetails.Rows.Add(); gvSalePromotionDetails.Rows[i].Cells["SLNO"].Value = (i + 1).ToString(); //gvSalePromotionDetails.Rows[i].Cells["PromotionId"].Value = dt.Rows[i]["ID"].ToString(); gvSalePromotionDetails.Rows[i].Cells["DeptId"].Value = dt.Rows[i]["DeptId"].ToString(); gvSalePromotionDetails.Rows[i].Cells["PromotionType"].Value = dt.Rows[i]["PromotionType"].ToString(); gvSalePromotionDetails.Rows[i].Cells["ExcellentMonths"].Value = dt.Rows[i]["ExeMonths"].ToString(); gvSalePromotionDetails.Rows[i].Cells["ExcellentPoints"].Value = dt.Rows[i]["ExePoints"].ToString(); gvSalePromotionDetails.Rows[i].Cells["GoodMonths"].Value = dt.Rows[i]["GoodMonths"].ToString(); gvSalePromotionDetails.Rows[i].Cells["GoodPoints"].Value = dt.Rows[i]["GoodPoints"].ToString(); gvSalePromotionDetails.Rows[i].Cells["AverageMonths"].Value = dt.Rows[i]["AvgMonths"].ToString(); gvSalePromotionDetails.Rows[i].Cells["AveragePoints"].Value = dt.Rows[i]["AvgPoints"].ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { objHRinfo = null; dt = null; } } }