我想ReportViewer
在 web 表单页面上动态设置运行时。我的 ReportViewer 在 aspx 页面上看起来像这样……</p>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" Height="90%"
Width="100%" OnReportError="ReportViewer1_ReportError">
</rsweb:ReportViewer>
我的课看起来像这样……
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; }
}
}
在后面的代码中,我执行以下操作来运行 ReportViewer……</p>
// 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();
我得到的错误如下:
尚未为数据源“CaseLoadForecastReportResultCV”提供数据源实例。
任何帮助都会很棒。