adding a sub report dynamically

4 posts, 0 answers
  1. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 20 May 2013 Link to this post

    I have a page that produces a number of reports by booths (for a trade show)
    a few booths (10 out of 200) need a subreport to be added
    I tried adding the subreport when the reports are built - the control is added but the report itself does not appear
    I moved my logic to the ItemDataBound event of the report selected and nothing appears
    what am I doing wrong?
    Private Sub VRSummaryStore_ItemDataBound(sender As Object, e As EventArgs)
        Dim srPowerBoys As SubReport
        Dim thisReport As InstanceReportSource
        Dim myFoot As Telerik.Reporting.ReportFooterSection
        Dim X_Unit, Y_Unit As Telerik.Reporting.Drawing.Unit
        Dim APoint, UPoint As Telerik.Reporting.Drawing.PointU
        Dim subReport As Reports.VRPowerBuys
        Dim dsSubReport As DataSet
        Dim BoothNumber As Integer
     
        myFoot = Me.ReportFooterSection1
        APoint = Me.srActualTotals.Location
     
        srPowerBoys = New SubReport
        srPowerBoys.Style.BackgroundColor = System.Drawing.Color.Chartreuse
        myFoot.Items.Add(srPowerBoys)
        srPowerBoys.Left = Me.srActualTotals.Left
        srPowerBoys.Top = APoint.Y + Me.srActualTotals.Height
        srPowerBoys.Size = Me.srActualTotals.Size
        thisReport = New InstanceReportSource
        subReport = New Reports.VRPowerBoys
        thisReport.ReportDocument = subReport
        BoothNumber = Me.Report.ReportParameters(0).Value
        dsSubReport = DataManager.GetDataSP("rpt_store_powerboys_show", BoothNumber.ToString)
        subReport.DataSource = dsSubReport
    End Sub
  2. Gimmik
    Gimmik avatar
    170 posts
    Member since:
    May 2011

    Posted 22 May 2013 Link to this post

    Hi Marianne,

    I just went through this same process a short time back.

    ItemDatabound is too late in the life cycle to add a new sub-report. Try moving your logic to the ItemDatabinding event.

    Let me know if this works for you. You'll also have to configure the connectionstring for the sub-report - but it looks like you're doing that in-code too.
  3. DevCraft banner
  4. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 22 May 2013 Link to this post

    changed the location of the code - but still no subreport
    it's dropping in the subreport control but not building the report that goes in it
    it is also building the dataset

    should I be creating a new report instance - or is there an existing report instance I should be attaching the code to?
  5. Elliott
    Elliott avatar
    391 posts
    Member since:
    May 2010

    Posted 22 May 2013 Link to this post

    my problem?
    missing one line
    srPowerBuys.ReportSource=subReport
Back to Top