I want to dynamically setup the ReportViewer at run time on a webform page. My ReportViewer looks like this on the aspx page…
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
Height="90%" Width="100%" OnReportError="ReportViewer1_ReportError">
</rsweb:ReportViewer>
My class looks like this….
namespace S43G.CV
{
[Serializable]
public class CaseLoadForecastReportResultCV
{
public Int64 M3Fe { get; set; }
public Int64 M3Grad { get; set; }
public Int64 M6Grad { get; set; }
public Int64 M12Grad { get; set; }
public Int64 Total { get; set; }
public Int64 GroupPart { get; set; }
public Int64 Year { get; set; }
}
}
In the code behind I do the following to run the ReportViewer…
// get a list from db
List<CaseLoadForecastReportResultCV> answer = svyCaseBllHdl.GetCaseLoadForcastReport(userInput);
// Reset the ReportViewer
ReportViewer1.Reset();
ReportViewer1.LocalReport.Dispose();
ReportViewer1.LocalReport.DataSources.Clear();
// build the Report Data Source
ReportDataSource rds = new ReportDataSource("S43G_CV_CaseLoadForecastReportResultCV", answer);
// set new values for ReportViewer
ReportViewer1.LocalReport.ReportPath = "S4_Reports/CaseLoadForecast.rdlc";
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
The error I get is the following…
A data source instance has not been supplied for the data source 'CaseLoadForecastReportResultCV'.
Any help would be great.