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

Unable to see result in reportviewer

1 Answer 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sri
Top achievements
Rank 1
Sri asked on 29 Feb 2012, 12:41 PM
Dear Telerik Team member,

 I am using Telerik report viewer with entity fraework.
This is the code I am using to bind the report to the control.
When I run the app. I am unable to see the result on the reportviewer, but I am able to get the result set from database.
Where am I doing wrong?
Help me please...

   Telerik.Reporting.EntityDataSource entityDataSource = new 
Telerik.Reporting.EntityDataSource();         <BR>            
entityDataSource.ObjectContext = 
typeof(MyEntities);<BR>            
entityDataSource.ObjectContextMember = 
"ReportSales";<BR>            
entityDataSource.Parameters.AddRange(new 
Telerik.Reporting.ObjectDataSourceParameter[] 
{<BR>            new 
Telerik.Reporting.ObjectDataSourceParameter("SalesID", 
typeof(System.Nullable<int>),18),<BR>            
new Telerik.Reporting.ObjectDataSourceParameter("category", 
typeof(System.Nullable<byte>), 
1)});<BR>            
<BR>            
Telerik.Reporting.Report report = new 
Telerik.Reporting.Report();<BR>            
report.DataSource = 
entityDataSource;<BR>           
<BR>            
this.DefaultReportViewer.Report = report;

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 29 Feb 2012, 01:01 PM
Hi Sri,

The code you've provided seems correct. A possible reason for not having any data in your report is if you have not provided any database columns, the report needs valid Expressions in order to display data. In other words, the report would not auto generate columns/rows based on your data, you have to manually set valid expressions (e.g. = Fields.MyFirstColumn) in the TextBox items. If your bind to lots of database columns, this could be a tedious process, so that is why we have provided you with a Report Wizard that would help you in designing your table and we highly recommend using it. As a new user, we also recommend reviewing the Designing Reports help section from the documentation, so you can get familiar with the product and the way it functions.

Kind regards,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Tags
General Discussions
Asked by
Sri
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or