以下代码可以很好地显示rdlc报告。但问题是 第一次加载页面后出现错误数据源名称正确时,尚未为数据源“StudentTranscript”提供数据源实例。
protected void btnLoad_Click(object sender, EventArgs e)
{
List<rStudentTranscript> list = StudentManager.GetStudentTrancriptById(studentId);
ReportDataSource rds = new ReportDataSource("StudentTranscript", list);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
}
}
如何解决这个问题?
答案 0 :(得分:0)
尝试添加
ReportViewer1.LocalReport.Refresh();