2013-10-12 210 views
0

我正在使用RDLC报表的项目,我想使用包含一些公司信息的页眉和页脚的主报表,并且它与不同的数据集绑定并在主体内部的报告我有一个子报表来显示报告的内容,这个子报表填写不同的数据集为不同的报告。RDLC报告中的子报表的分页问题

一切工作正常,但当子报表中有更多的记录,然后它分为分页,当我点击下一页,然后它不工作,再次显示第一页。

Infacat我错过了一项技术,但我无法识别它。

我的代码绑定的报告低于:

private void LoadReport() 
{ 
    var objAccess = new DataAccess(); 
    _dataSet = objAccess.CompanyGetAll(); 
    var mainReport = new StreamReader(Server.MapPath("~/Reports/ComanyInfo.rdlc")); 
    ReportViewerTraineePayments.LocalReport.LoadReportDefinition(mainReport); 
    ReportViewerTraineePayments.LocalReport.DataSources.Clear(); 
    ReportViewerTraineePayments.LocalReport.DataSources.Add(new ReportDataSource("DS_CompanyInfo", _dataSet.Tables[0])); 

    var subReport = new StreamReader(Server.MapPath(DynamicReportName)); 
    ReportViewerTraineePayments.LocalReport.SubreportProcessing += 
     new SubreportProcessingEventHandler(localReport_SubreportProcessing); 
    ReportViewerTraineePayments.LocalReport.LoadSubreportDefinition("Rpt_Content", subReport); 
} 

private void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e) 
{ 
    e.DataSources.Add(new ReportDataSource(DynamicDataSetName, DynamicReportDataSource.Tables[0])); 
} 

回答

0

我做到了我自己通过设置AsyncRendering="True"

保护无效的Page_Load(对象发件人,EventArgs的) { 如果(!IsPostBack) { LoadReport(); } }