Telerik子报告以编程方式 [英] Telerik Subreport Programmatically

查看:124
本文介绍了Telerik子报告以编程方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在使用VB.Net 2012和Telerik Reporting V:6.1.12.611。我的问题是,如何使用SubReport调用所有报告显示在主报告中?



我遇到创建主报告的问题,以查看我的所有报告在子报告中。我从不同的表中检索信息并发送到datagridview,以便在完成发送到Generic List包含一系列CLASS对象后操作数据。要查看一个报表100%工作,但当我尝试使用子报表来调用报表时,报表上没有任何内容。我创建了空的数据集链接到CLASS和LIST OF工作完美只有SubReport和配置&让我失望的参数。



我尝试此代码不会在子报表中显示数据

Hi Everyone,

I'm using VB.Net 2012 and Telerik Reporting V:6.1.12.611. My question is, How to call all reports to display in Master Report using SubReport?

I'm having a problem of creating Master Report in order to view all my report within a subReports. I retrieved the information from different tables and send to datagridview in order manipulate the data once I done send to Generic List contains a series of CLASS objects. To View one report works 100%, but when I try to used sub-report to call a report nothing appear on the report. I created empty dataset link to the CLASS and LIST OF works perfect only SubReport and configuration & Parameters which is failing me.

I try this code is not displaying data within a subReport

Dim rpt As New rptMasterReport()
'retrieving data from the database and send data to Generic List contains a series of CLASS objects
setMonthlyTransReport()
Dim subRpt As New Telerik.Reporting.SubReport()
Dim rptSource As New Telerik.Reporting.InstanceReportSource()
rptSource.ReportDocument = rpt
rptSource.Parameters.Add(New Telerik.Reporting.Parameter("R1", "=Fields.R1"))
subRpt.ReportSource = rptSource
'bind datasource with Generic List contains a series of CLASS objects
rpt.DataSource = lstDailyTicketsRevenue
' Assigning the report to the report viewer.
frmReportViewer.ReportViewer1.ReportSource = rptSource
                          
' Calling the RefreshReport method for WinForms application.
frmReportViewer.ReportViewer1.RefreshReport()
'call form viewr
frmReportViewer.Show()





任何帮助将不胜感激。

谢谢!



Any Help will be appreciated.
Thanks!

推荐答案

尝试这样的事情:



var subReport = new YourSubReport();

var subReportItem = MasterReport.Items.Find(typeof(SubReport),true)[0] as SubReport;

subReportItem.ReportSource = new InstanceReportSource {ReportDocument = subReport};
Try this something like this:

var subReport = new YourSubReport();
var subReportItem = MasterReport.Items.Find(typeof(SubReport), true)[0] as SubReport;
subReportItem.ReportSource = new InstanceReportSource { ReportDocument = subReport };


这篇关于Telerik子报告以编程方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆