I have a visual studio 2013 web application which works with entity framework and I want to display a simple tabular data report using a RDLC report.
I have created a seperate web page and added a reportviewer control. Also I have created a RDLC file and added the data source from a C# function which returns a List
of custom objects. This way it is configurable from the report designer, but when the page loads in the browser an error A data source instance has not been supplied for the data source 'DataSet1'
is shown.
Report design
HTML markup
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Alumni\Reports\Report1.rdlc"></LocalReport>
</rsweb:ReportViewer>
For above implementation I got the error of not giving a data source, but as Yuliam Chandra suggested, I added the below code and now the report works.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", Business.ReportManager.GetMemberDetails(1)));
}
}
Please help me to solve this issue. I just need to display a simple report using RDLC and the data source is a public static function with an argument which returns a list of objects.
Have you set the data source in the page load?
YourReportViewer.LocalReport.DataSources.Add(new ReportDataSource("testDataSet", list));