As your question is too general, maybe you should first take a look at this
There are more then one way to show relevant data in the subreport to the master report.
Let's suppose we have Invoice/InvoiceDetail reports.
First approach - to use report parameters in the detail report:
1. In the InvoiceDetail report set up a datasource that pulls out all the detail rows.
2. Set up a parameter(s) in InvoiceDetail report to be used in filter expression, for example InvoiceID.
3. Set up a Filter
in the InvoiceDetail report that uses InvoiceID parameter to filter the rows
5. In the master report place a SubReport item in the details section and choose InvoiceDetail as ReportSource.
6. Set up the parameters of the SubReport item to pass the value of Fields.CustomerID to the CustomerID parameter of InvoiceDetail report.
Second approach - to use the NeedDataSource
of the SubReport
Use the NeedDataSource event of the SubReport item placed on the master report to retrieve the relevant detail data to the current master row and pass that data as a DataSource of the detail report. Something like:
Private Sub SubReport1_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubReport1.NeedDataSource
//This is the way to get the SubReport processing item in the current detail section
Dim subreport as Telerik.Reporting.Processing.SubReport = TryCast(sender, Telerik.Reporting.Processing.SubReport)
//This is the way to get the current master row
Dim row as DataRow = (TryCast(subReport.DataItem, System.Data.DataRowView)).Row
//Retrieve detail data for the current detail row
Dim connectionString As String = "Data Source=***;Initial Catalog=***;Persist Security Info=True;User ID=***;Password=***"
Dim commandText As String = "SELECT StockName, Qty, Price FROM InvoiceDetails WHERE InvoiceID = " & row("CustomerID")
Dim da As SqlDataAdapter = New SqlDataAdapter(commandText, connectionString)
subreport.InnerReport.DataSource = da
Also, you can use the SubReport item to create reports binded to business objects. If that is the case you can also use the NeedDataSource event to provide data to the detail report.
Please review the article mentioned above, try the patterns shown here and write us again if you have more specific questions.
the Telerik team