Add a subreport

2 posts, 0 answers
  1. Mark
    Mark avatar
    82 posts
    Member since:
    Jan 2015

    Posted 24 Jun 2015 Link to this post

    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()

  2. Mark
    Mark avatar
    82 posts
    Member since:
    Jan 2015

    Posted 25 Jun 2015 in reply to Mark Link to this post

    finally figured it out:

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

Back to Top