This is a migrated thread and some comments may be shown as answers.

Add a subreport

1 Answer 17 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 24 Jun 2015, 12:06 PM

I am having trouble adding a sub report to my report.  I have created a subreport web page (VB.net).  Here is the code that works for adding the details but the subreport doesn't get displayed.  The top table is the subreport.  Any help is greatly appreciated.

'bottom table
Dim rptReport As New rptMSVS
rptReport.DocumentName = tmpStartDate.ToString("MM.dd.yyyy") 'tab name
rptReport.DataSource = dtBottom

'top table
Dim rptSummary = New sbrSummary
rptSummary.DataSource = dtTop

Dim reportBook As ReportBook = New ReportBook
reportBook.Reports.Add(rptSummary)
reportBook.Reports.Add(rptReport)

'add the sheet to the report
rptMSVS.Reports.Add(rptReport)
rptMSVS.Reports.Add(rptSummary)

 

'display the Report
Dim rptProcessor As New Telerik.Reporting.Processing.ReportProcessor()
Dim instance As New InstanceReportSource()
Dim hshTable As New Hashtable()
instance.ReportDocument = rptMSVS
Dim result As Telerik.Reporting.Processing.RenderingResult = rptProcessor.RenderReport("XLS", instance, hshTable)

rptViewer.ReportSource = instance
rptViewer.DataBind()

1 Answer, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 25 Jun 2015, 01:41 PM

finally figured it out:

Dim rptSummary = New sbrSummary
Dim instanceTop As New InstanceReportSource
rptSummary.DataSource = dtTop
instanceTop.ReportDocument = rptSummary
rptReport.sbrSummary.ReportSource = instanceTop

Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Share this question
or