Parameter for subreport

3 posts, 1 answers
  1. Maveric
    Maveric avatar
    39 posts
    Member since:
    Apr 2007

    Posted 28 Feb 2008 Link to this post


    I Have a report webpage with multiple subreport in it.
    the datesource of the report of each subreport is a stored procedure
    with a parameter. So i need to pass this parameter.
    I add a property of each report
        Public Property IdCible() As String 
                Return SqldaCible.SelectCommand.Parameters(0).Value.ToString 
            End Get 
            Set(ByVal value As String) 
                SqldaCible.SelectCommand.Parameters(0).Value = value 
            End Set 
        End Property 

    For a page with a simple report i make that :
    Dim Idcible As String = Request.QueryString("IdCible").ToString 
    CType(ReportViewer1.Report, Report2).IdCible = Idcible 
    How to make the same with a subreport or perhaps there is another method ?


  2. Answer
    Ivan avatar
    519 posts

    Posted 03 Mar 2008 Link to this post

    Hello Maveric,

    Attached you can find a sample solution with a master-detail report realized with sub-report. The sub-report's data source calls a stored procedure with one parameter. In the OnItemDataBinding event handler of master report's detail section we assign value to the sub-report's query parameter. Sample is given in VB and C# for both Win and Web applications. Here is a brief description of solution:
    • Projects:
      • WinAppCS and WinAppVB - Windows forms applications to preview report;
      • WebSiteCS and WebSiteVB - Web applications to preview report;
      • ClassLibraryCS and ClassLibraryVB - class libraries with reports.
    • Places to review:
      • ReportManagers.* files for master report - review the code inside the detail-section's ItemDataBinding event-handler - here we set the relation value for sub-report's query parameter;
      • ReportSubordinates.* files for detail report - here is the ManagerID property where initialization of query parameter occurs (you already did this).
    Please give it a try and let me know if there are more questions.

    All the best,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft R3 2016 release webinar banner
  4. Maveric
    Maveric avatar
    39 posts
    Member since:
    Apr 2007

    Posted 03 Mar 2008 Link to this post

    Hi Kevin,

    It was perfect,

    Thank you very much.

Back to Top