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

Parameters and programattic datasource

2 Answers 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jaymie
Top achievements
Rank 1
Jaymie asked on 09 Jul 2010, 05:16 PM
I need to create a datasource in code for a parameter.
The issue I have is when I create the parameter, I set the ValueMember and DisplayMember in the designer and then in the code behind I do this:

    Private Sub ChangeoverRunTimeChart_NeedDataSource(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.NeedDataSource
        ReportParameters("WorkCentres").AvailableValues.DataSource = GetWorkCentresForDDL()
        ReportParameters("WorkCentres").AvailableValues.DisplayMember = "WorkCentreCode"
        ReportParameters("WorkCentres").AvailableValues.ValueMember = "ID"
    End Sub

Which is the needdatasource event for the report.
When I load up the report, it just shows an empty textbox for the WorkCentres parameter. I can not get it to show a combobox.
Could someone tell me what I am doing wrong please?

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 09 Jul 2010, 05:48 PM
Hi Jaymie,

Report parameters typically filter report data that is retrieved from a data source. Thus it is too late to bind them in the NeedDataSource event, which is the last place where you can provide datasource to the report itself. You should move the code in the report constructor instead of NeedDataSource.

Greetings,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Jaymie
Top achievements
Rank 1
answered on 12 Jul 2010, 10:05 PM
thank you very much for this, it has worked perfectly :)
Tags
General Discussions
Asked by
Jaymie
Top achievements
Rank 1
Answers by
Steve
Telerik team
Jaymie
Top achievements
Rank 1
Share this question
or