Hello Telerik team,
do you have a sample project same as the (master detail report) but using programmatic coding. Just like in the sample,
1. Created a Department class and an employee class, the department class contain a list of employee as one of the property for the class.
2. Created as employee report with some details that will serve as my subreport
3. Created as master class that will hold the department information, then added a subreport control (RptEmployee as the ReportSource)
4. I assigned the parameters from the UI (DepartmentID)
5. The datasource was assigned at the WEB UI level (ReportViewer) RptDepartment.datasource
Now I'm stuck on the Subreport1_needdatasource event (how do I pass the data to the subreport)?
I do have access to the complete datasource so as the parameter which I can see from InnerReport.Parameter, but how do I go about assigning the right datasource item during need datasource? i got the a sample code below and somehow working but is there a better way?
Dim sr As Telerik.Reporting.Processing.SubReport = TryCast(sender, Telerik.Reporting.Processing.SubReport)
If Not sr Is Nothing Then
Dim deptID As Integer = sr.InnerReport.Parameters.Values(0)
For Each item As Department In Me.DataSource
If item.DepartmentID = deptID Then
sr.InnerReport.DataSource = item.Employees
Exit For
End If
Next
End If
Thanks for your help.
do you have a sample project same as the (master detail report) but using programmatic coding. Just like in the sample,
1. Created a Department class and an employee class, the department class contain a list of employee as one of the property for the class.
2. Created as employee report with some details that will serve as my subreport
3. Created as master class that will hold the department information, then added a subreport control (RptEmployee as the ReportSource)
4. I assigned the parameters from the UI (DepartmentID)
5. The datasource was assigned at the WEB UI level (ReportViewer) RptDepartment.datasource
Now I'm stuck on the Subreport1_needdatasource event (how do I pass the data to the subreport)?
I do have access to the complete datasource so as the parameter which I can see from InnerReport.Parameter, but how do I go about assigning the right datasource item during need datasource? i got the a sample code below and somehow working but is there a better way?
Dim sr As Telerik.Reporting.Processing.SubReport = TryCast(sender, Telerik.Reporting.Processing.SubReport)
If Not sr Is Nothing Then
Dim deptID As Integer = sr.InnerReport.Parameters.Values(0)
For Each item As Department In Me.DataSource
If item.DepartmentID = deptID Then
sr.InnerReport.DataSource = item.Employees
Exit For
End If
Next
End If
Thanks for your help.