Setting a parameter default value while using available values dropdown

2 posts, 0 answers
  1. Mark
    Mark avatar
    12 posts
    Member since:
    Oct 2012

    Posted 07 Aug 2015 Link to this post

    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?

  2. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 11 Aug 2015 Link to this post

    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
Back to Top