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

ObjectDataSource to populate Report Parameters

1 Answer 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 11 Nov 2015, 05:19 PM

My question is: Why does the report "get" the list of ProfileItems that it uses for the report parameter twice?
Here's the setup:

Q3 2015 report
Adding a ReportParameter (right click report surface, select ReportParameters...)
Click the Add button, name it ProfileId.
Open the AvailableValues drop down and add a new ObjectDataSource for the Data Source of this parameter.
I'm using simple "POCO" object that returns an IEnumerable<ProfileItem> and ProfileItem has a First/Last Name and an Id field. Using a quick SQL query it populates all the active profiles from the database. Simple so far. Set the ValueMember to the Id field (it's a Guid) and the DisplayMember to the name. All done! Oh wait...I also have to set the Value.
Also, the report doesn't like Guids, so I've added a getter property that just returns the Guid Id as string.
Ok, now it all works fine!

Except, I was nosey and noticed that it accesses the data source to return the list of ProfileItem twice.
Why would it access the function twice?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 16 Nov 2015, 01:55 PM
Hello Ken,

The AvailableValues.DataSource will be called each time the report source is resolved by the Reporting engine. This will happen when you preview/run a report in a viewer, when your export/print a report, when you switch between print preview/interactive view.
This may also happen as many times as the Reporting engine requires the report source to be resolved. One of the purposes of the multiple calls is to correctly retrieve and display cascading parameters.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ken
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or