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

DataSource Chart during RunTime

1 Answer 125 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Frédéric Martin
Top achievements
Rank 1
Frédéric Martin asked on 13 Jul 2009, 07:10 PM
Hi I recently made a post regarding the cast that I needed to create if I wanted to assign a DataSource to my Telerik Report Q1 2009 during RunTime from my WebForm1 page which contains a ReportViewer.

((Telerik.Reporting.Report)this.ReportViewer1.Report).DataSource = ds;

Now I would like to from the same WebForm1 page access the Chart control that resides in my Report, Report1.

I also have a reporting Table as well that I would also like to hook up.

How would I attach a DataSource to both of these controls during RunTime in my WebForm1.cs code behind page?

Many thanks

1 Answer, 1 is accepted

Sort by
0
Frédéric Martin
Top achievements
Rank 1
answered on 14 Jul 2009, 01:45 AM
Everyone, I found the answer, we can use the NeedDataSource for the Chart control in the Report1.cs file as so

        private void chart1_NeedDataSource(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart;
            chart.DataSource = /* your datasource e.g. returned DataSet, Enteprise Library DAAB */
        }

Using this method does not cause an Exception error when adding the Report to a ReportViewer in your WebForm in your project and builds successfully.

Regards
Tags
General Discussions
Asked by
Frédéric Martin
Top achievements
Rank 1
Answers by
Frédéric Martin
Top achievements
Rank 1
Share this question
or