private void Generate() { ReportViewer1.Visible = true; try { DataTable temp = new DataTable(); temp = GetReportData(); if (temp.Rows.Count > 0) { ReportDataSource rptDataSource = new ReportDataSource("MCB_DataSet_Balances_Summary_Of_Agents", temp); this.ReportViewer1.LocalReport.DataSources.Clear(); List <ReportParameter> rpParam = new List <ReportParameter>(); rpParam.Add(new ReportParameter("OrganizationName", RDLCReportClass.GetOrgName())); /*OrganizationName*/ rpParam.Add(new ReportParameter("ReportHeading", RDLCReportClass.GetReportHeader("R1"))); /*ReportHeading*/ this.ReportViewer1.LocalReport.DataSources.Add(rptDataSource); this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("CompanyBalanceReport.rdlc"); this.ReportViewer1.DataBind(); this.ReportViewer1.LocalReport.SetParameters(rpParam); this.ReportViewer1.LocalReport.Refresh(); } else { Response.Redirect("CompanyBalanceReport.aspx?IsRecord=" + "0" + "&msg=" + "No Record Found"); } } catch (Exception ex) { Response.Write("Exception is:" + ex); } }
private void Generate(string CompanyCode, string fileName, string Authorize1, string Authorize2, string IBC1, string IBC2) { ReportViewer1.Visible = true; try { DataTable temp = new DataTable(); string[] whereClause = null; whereClause = new string[2]; whereClause[0] = CompanyCode; whereClause[1] = fileName; temp = GetReportData(whereClause); if (temp.Rows.Count > 0) { ReportDataSource rptDataSource = new ReportDataSource("MCB_DataSet_DraftTransaction", temp); this.ReportViewer1.LocalReport.DataSources.Clear(); List <ReportParameter> rpParam = new List <ReportParameter>(); rpParam.Add(new ReportParameter("OrganizationName", RDLCReportClass.GetOrgName())); /*OrganizationName*/ rpParam.Add(new ReportParameter("ReportHeading", RDLCReportClass.GetReportHeader("R2"))); /*ReportHeading*/ rpParam.Add(new ReportParameter("Authorize1", Authorize1)); rpParam.Add(new ReportParameter("Authorize2", Authorize2)); rpParam.Add(new ReportParameter("IBC1", IBC1)); rpParam.Add(new ReportParameter("IBC2", IBC2)); this.ReportViewer1.LocalReport.DataSources.Add(rptDataSource); this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("DraftTransactionRpt2.rdlc"); this.ReportViewer1.DataBind(); this.ReportViewer1.LocalReport.SetParameters(rpParam); this.ReportViewer1.LocalReport.Refresh(); } else { Response.Redirect("DraftTransactionReport.aspx?errorMsg=" + "No record found."); } } catch (Exception ex) { Response.Write("Exception is:" + ex); } }