I want to set the datasource
of my RDLC
report to the return of a specific method .but the report wizard can't detect my methods.
The Method is in Class Utility
in DataLayer
namespace and my report in another class library(FinanceReportBundle
).
The Class is like that :
namespace DataLayer
{
public class Utility
{
public static IEnumerable<object> GetAnalysisDataForConsecutiveYears(int year, int periodTypeId, int period)
{
////Business
}
}
}
You don't have to do it in the designer. You can set your data source in code easily, like this:
var dataSource = getmyDataSource();
var rds = new ReportDataSource("myDataSourceName", dataSource);
this.reportViewer1.LocalReport.DataSources.Add(rds);
this.reportViewer1.LocalReport.ReportPath = "path your your rdlc";
this.reportViewer1.RefreshReport();