我正在向子报告发送一个参数以显示图像,但没有这样做。为什么 ?
我以相同的方式在父报表中加载了图像,但该过程在子报表中不起作用。
为什么 ?
家长报告:
public void Fill_AuditsReport()
{
ReportViewer1.AsyncRendering = false;
ReportViewer1.SizeToReportContent = true;
ReportViewer1.ZoomMode = ZoomMode.FullPage;
this.ReportViewer1.Reset();
DataTable dt = new DataTable();
PersonalInfo.ManagePersonalInfo MngPersonalInfo = new PersonalInfo.ManagePersonalInfo();
dt = MngPersonalInfo.ReportSelectPersonalInfo();
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/DataManagementReports/Report.rdlc");
ReportDataSource rpds = new ReportDataSource("DataSetEmployeeInfo", dt);
ReportViewer1.LocalReport.EnableExternalImages = true;
string FilePath = new Uri(Server.MapPath("~/SiteImages/")).AbsoluteUri;
ReportParameter param = new ReportParameter("ImgPath", FilePath);
ReportViewer1.LocalReport.SetParameters(param);
ReportViewer1.LocalReport.Refresh();
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rpds);
ReportViewer1.Visible = true;
}
子报告:(钻取)
protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
{
try
{
LocalReport Report = (LocalReport)e.Report;
int ID = Convert.ToInt32(e.Report.GetParameters()[0].Values[0].ToString());
Report.DataSources.Add(new ReportDataSource("DataSetEmployeeAllData", LoadValues(ID)));
Report.Refresh();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
private DataTable LoadValues(int PersonalInfoID)
{
try
{
//DataSetPersonalInfoTableAdapters.ReportEmployeeAllDataTableAdapter tba = new DataSetPersonalInfoTableAdapters.ReportEmployeeAllDataTableAdapter();
DataSetEmployeeAllDataTableAdapters.ReportEmployeeAllDataTableAdapter tba = new DataSetEmployeeAllDataTableAdapters.ReportEmployeeAllDataTableAdapter();
return tba.GetData(PersonalInfoID);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
throw;
}
}