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

Binding to datatable at runtime

1 Answer 554 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 23 Aug 2011, 05:05 PM
I realize this is jumping into the deep end early but I have just started using Telerik reporting to replace a Crystal Report that I was generating for my company based on an Access database.  Our current infrastructure is set up using an individual Access DB per project so the data binding must be accomplished at run time. In CR, I could simply create the report with no datasource and at run time bind the datasource using

crComCheck1.SetDataSource(dgvComCheck.DataSource)

To mimic this functionality, I have created a Telerik report with an ObjectDataSource.  This ObjectDataSource has its DataSource property set to an xsd dataset that I have defined in my Visual Studio project with the column structure that I desire.  In doing this, I am able to set up a report with the column structure that I would ultimately like to see produced with an object to bind to at runtime.  In code, I am binding this datasource to a datagridview using 

TrComCheck1.ObjectDataSource1.DataSource = dgvComCheck.DataSource

When I go to the Telerik report viewer and refresh the report, it properly pulls all of the columns and row data that I want to see but produces a table for each individual record in the dataset.  So if there were 4 records in the dataset, there would be 4 tables each with the 4 correct records. I was wondering if you could offer some guidance as to why it was behaving in this fashion. Thank you.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 26 Aug 2011, 02:07 PM
Hi Michael,

It seems that you have used a data item (subreport, table, list or crosstab) in report's detail section. However data items are separate data regions and they do not make use of the report's data source. They have their own DataSource property which you need to set in order to populate the item with data. However if you have in addition set the Report.DataSource property the report engine will create a detail section with the data item for every row of your report datasource. To avoid this behavior our suggestion is to set the Report.DataSource property to none or move the table item to another non repeating section such as report header or unbound group header (group without grouping).

Additional information: Data Items

Greetings,
Peter
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

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