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

Setting a parameter default value while using available values dropdown

1 Answer 463 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 07 Aug 2015, 01:28 PM

I have a report that I want to set parameter available values that a re data bound but I want the report to load using the users ID initially. Then they would be able to select someone else from the dropdown to view their report. It looks like it is one or the other right now. If I set the available values data source the report's needsdatasource event does not fire and nothing is loaded. If I set the parameter available values in the code it will run using the default parameter but the dropdown box does not get displayed in the report.

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 11 Aug 2015, 12:43 PM
Hi Mark,

The initial parameter's value can be set in the report or passed on displaying the report through the wrapping ReportSource object's Paremeters collection. It must be a valid value existing the parameter's AvailableValues.DataSource (ValueMember values).

The report's NeedDataSource event will fire if the report's DataSource property is not set. Thus you can set the parameter's AvailableValues.DataSource via data source component or in code (in the report's constructor), and then set the report's DataSource in its NeedDataSource event based on the selected parameter's value.

You can also use a parameterized data retrieval method, which arguments are mapped to report parameters e.g. Using Parameters with the SqlDataSource component.  Thus you do not need to use the NeedDataSource event to supply data.


If you need further help, please open a support ticket and send us a demo project including a test report and data, and reproducing the problem.

Regards,
Stef
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
Mark
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or