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

ObjectDataSource Disappearing and Report not displaying table rows as per data

1 Answer 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rajiv
Top achievements
Rank 1
Rajiv asked on 30 Jul 2014, 09:03 PM
I have created a sample project here, please download it and let me know what is the issue?
https://www.dropbox.com/s/98ufwhrgnj19bdw/SampleReportTest.zip

I need help in generating a sample report can you please help?
I create a design report file and assign it a ObjectDataSource where its datasource is a class.

In my code behind, I give a datatable with the same fields as of the class to render on my report, but its just doesn’t display the rows? Any ideas what I might be doing wrong?

See sample project from my dropbox link above. Also, note once I build the dataexplorer shows no fields/properties of the objectDataSource1.

Rajiv 

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 04 Aug 2014, 05:44 PM
Hi Rajiv,

In the provided demo you use a Table item, which is a data item having its own DataSource property. Thus at run-time you need to get the Table item from the report instance's Items collection and set its data source e.g.:
// Creating and configuring the ObjectDataSource component:
         Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource();
         objectDataSource.DataSource = tempdt; // GetData returns a DataTable
 
         // Creating a new report
         Report1 report = new Report1();
 
         (report.Items.Find("table1", true)[0] as Telerik.Reporting.Table).DataSource = objectDataSource;
 
         Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
         reportSource.ReportDocument = report;
 
         reportViewer1.ReportSource = reportSource;
         reportViewer1.RefreshReport();


More information about setting report's data at run-time is available in the Changing the connection string dynamically according to runtime data KB article.


I hope the above information helps you.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Rajiv
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or