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

report and subreport parameters

2 Answers 99 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 13 Mar 2013, 04:20 PM
Hi Telerik team,

I need to pass some of my entities as parameters to my report and then propagate them down to my subreport.

i tried something like this: 

var instanceReportsource = new InstanceReportSource();
instanceReportsource.ReportDocument = new InventoryReport
instanceReportsource.Parameters.Add("location", location);
instanceReportsource.Parameters.Add("filters", filters);
ReportViewer2.ReportSource = instanceReportsource;
ReportViewer2.RefreshReport();
ReportViewer2.Update();

The problem is when i hook to the item binding events I see no parameters in the processing items. 

What am I doing wrong. What is the best way to pass the entities to the report and subreport?

thanks.

2 Answers, 1 is accepted

Sort by
0
Ivan
Top achievements
Rank 1
answered on 13 Mar 2013, 04:35 PM
OK, I now saw that the parameters can only be of simple types so I guess parameters wont do it. 

Before i elaborate here is my scenario. 

a report  contains a recursive subreport (source is the same as the top level report)
i use databinding reportsource with a static method to pass data to the subreports
hooking to the needdatasource event does not work because of the report source already assigned to the top level report. 

I tried creating properties in my report to which i can assign the entities but because of the static data method for the subreport i cannot access them.

Do you have any suggestions?

thanks.

 
0
Ivan
Top achievements
Rank 1
answered on 14 Mar 2013, 08:13 AM
Defining properties for the entities on the report and using item.ItemDefinition.Report actually works.

Tags
General Discussions
Asked by
Ivan
Top achievements
Rank 1
Answers by
Ivan
Top achievements
Rank 1
Share this question
or