MVC-RDLC ReportViwer在子报表上添加数据集后显示错误

时间:2019-03-03 14:15:27

标签: asp.net-mvc model-view-controller rdlc reportviewer report-viewer2010

大家好,

我有问题,需要帮助, 我的问题是将数据集添加到子报表并运行显示以下消息的应用程序:

    Data retrieval failed for the subreport, 'Subreport2', located at: 
###Path###. Please check the log files for more information. 
  

下面的一些代码:

public ActionResult Index(){

        reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\" + _rptFileName + ".rdlc";
        reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dsDocuments", GetDataAsObjectOfReport().TableA));

        reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
        reportViewer.LocalReport.Refresh();
}


public void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
    int documentID = Convert.ToInt32(e.Parameters["ID"].Values[0].ToString());
    ReportDataSource rds = new ReportDataSource()
    {
        Name = "dsReplies",
        Value = GetDataAsObjectOfReport().TableB.Where(x => x.DocumentID == documentID).ToList()
    };
    e.DataSources.Add(rds);
}

请帮助我。 谢谢你,UW ...

0 个答案:

没有答案