private void BindGrid() { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } _BillingCompany = new Bill_Sys_BillingCompanyDetails_BO(); DataSet ds = new DataSet(); DataTable OBJDTSum = new DataTable(); DataRow objDRSum; string Office_Id = ""; try { DataTable objDSOfficeWise = new DataTable(); ds = _BillingCompany.GetOfficeWisePatientInfo(txtCompanyID.Text, StartDate.ToString(), EndDate.ToString(), OfficeId.ToString(), DocorId.ToString(), Status.ToString()); objDSOfficeWise = DisplayOfficeInGrid(ds); grdAllReports.DataSource = objDSOfficeWise; grdAllReports.DataBind(); //Code To Fill Second Grid OBJDTSum.Columns.Add("SZ_OFFICE"); OBJDTSum.Columns.Add("SZ_PATIENT_NAME"); OBJDTSum.Columns.Add("SZ_DOCTOR_NAME"); OBJDTSum.Columns.Add("DT_EVENT_DATE"); OBJDTSum.Columns.Add("SZ_INSURANCE_NAME"); OBJDTSum.Columns.Add("SZ_OFFICE_STATE"); OBJDTSum.Columns.Add("SZ_OFFICE_ZIP"); for (int i = 0; i < grdAllReports.Items.Count; i++) { string str = grdAllReports.Items[i].Cells[5].Text.ToString(); if (grdAllReports.Items[i].Cells[5].Text.ToString() == " " && grdAllReports.Items[i].Cells[3].Text.ToString() == " ") { Office_Id = grdAllReports.Items[i].Cells[0].Text.ToString(); } if (grdAllReports.Items[i].Cells[4].Text.ToString() == " " && str.Substring(0, 4) == "<b>T") { objDRSum = OBJDTSum.NewRow(); objDRSum["SZ_OFFICE"] = Office_Id.ToString(); objDRSum["SZ_PATIENT_NAME"] = grdAllReports.Items[i].Cells[0].Text.ToString(); objDRSum["SZ_DOCTOR_NAME"] = grdAllReports.Items[i].Cells[1].Text.ToString(); objDRSum["DT_EVENT_DATE"] = grdAllReports.Items[i].Cells[2].Text.ToString(); objDRSum["SZ_INSURANCE_NAME"] = grdAllReports.Items[i].Cells[3].Text.ToString(); //objDRSum["SZ_OFFICE_STATE"] = grdAllReports.Items[i].Cells[4].Text.ToString(); objDRSum["SZ_OFFICE_ZIP"] = grdAllReports.Items[i].Cells[5].Text.ToString(); OBJDTSum.Rows.Add(objDRSum); } } grdTotalCount.DataSource = OBJDTSum; grdTotalCount.DataBind(); //end Code } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }