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

Parameter for subreport

2 Answers 395 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Maveric
Top achievements
Rank 2
Maveric asked on 28 Feb 2008, 10:04 PM
Hi,

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 
        Get 
            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 ?

Thanks

Eric

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan
Telerik team
answered on 03 Mar 2008, 10:03 AM
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,
Ivan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Maveric
Top achievements
Rank 2
answered on 03 Mar 2008, 04:00 PM
Hi Kevin,

It was perfect,

Thank you very much.

Maveric
Tags
General Discussions
Asked by
Maveric
Top achievements
Rank 2
Answers by
Ivan
Telerik team
Maveric
Top achievements
Rank 2
Share this question
or