User-1367260019 posted
Hi I cannot seem to get a simple report to work using codebehind to populate a report and I'm also confused how they work.
using - Microsoft.ReportViewer.WebForms, Version=10.0.0.0
Firstly to create a report I have to create a dataset within my project (I dont want to do this as I just want to populate the report with data from my Business Access Layer which will go and get a table of data for the datasource.
First Question is can I create the report based on a dataset, then get rid of it and then supply the data for the report with code behind?
This is my code behind that does not want to work, what am I doing wrong?
Question: I do not understand what rds.Name is doing.
If I then run the report with this code behind I get:
An error occurred during local report processing.
The report definition for report 'E:\Project\MyCompanies.rdlc.rdlc' has not been specified
Could not find file 'E:\ProjectMyCompanies.rdlc.rdlc'.
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.Reset();
ReportViewer1.LocalReport.Dispose();
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rds = new ReportDataSource();
rds.Name = "MyDataSet";
DataTable dt = new CompaniesBAL().GetCompanyName();
rds.Value = dt;
ReportViewer1.LocalReport.ReportPath = "MyCompanies.rdlc";
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
Any help would be appreciated.
Could not find a dedicated report forum, is there one?