My main Report and SubReport is very similar to each other, using same parameters and formula the only difference is their order in the derails section. Now When I load the subreport in the report and run it, ASP.NET keeps on asking to enter values for the parameters used.
I think I need to have a code that loads the subreport.
protected void Page_Load(object sender, EventArgs e)
{
report.Load(Server.MapPath("MonthlySalesReportP.rpt"));
report.SetDatabaseLogon
("sa", "pw", @"databasename, "servername");
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
CrystalReportViewer1.DataBind();
CrystalReportViewer1.SeparatePages = false;
report.SetParameterValue(0, MonthLastYear);
report.SetParameterValue(1, MonthCurrent);
report.SetParameterValue(2, MonthPrevious);
report.SetParameterValue(3, RP);
report.SetParameterValue(4, Loc);
report.SetParameterValue(5, cms);
report.SetParameterValue(6, YearCurrent);
report.SetParameterValue(7, YearPrevious);
report.SetParameterValue(8, YearLastYear);
report.SetParameterValue(9, FullName);
}
Should I include a code that is needed to read the subreport?
I see this suggestion
report.SetDataSource(dtproductview);
report.Subreports[0].SetDataSource(dsHeader.Tables[0]);
report.Subreports[1].SetDataSource(dsFooter.Tables[0]);
But i do not have a datatable or dataset, it is directly from a stored procedure
Have you tried Linking the parameters of the subreport to the main report?
(Change subreport links
in Subreport context menu)
You can try, also:
report.Subreports[0].SetParameterValue(0, MonthLastYear);