0
votes

I have a simple .RDLC report which does not show on it's ASPX page. My ASPX code is:

<rsweb:ReportViewer ID="rvReport" runat="server" Height="500px" Width="100%" 
    Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
    WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
    <LocalReport ReportPath="reports\rptAttendee.rdlc">
    </LocalReport>
</rsweb:ReportViewer>

In the .cs file, I create a dataset from my Entity Framework context and convert it to a ReportData Source as follows:

rvReport.LocalReport.DataSources.Clear();
ReportDataSource dataSource = new ReportDataSource("dsAttendees", attendees);
rvReport.LocalReport.DataSources.Add(dataSource);
rvReport.LocalReport.Refresh();

I have confirmed that the datasource gets created with data and the report view registers the datasource after it is added.

On the RDLC file, I created a empty datasource with the same name (dsAttendees) and exact same columns/types. When I run the web application, the ASPX page does not show the report. Inspecting the page, I do see the report viewer control but it's empty; even the non-databound text and the toolbar do not appear.

I suspect the issue is that the RDLC file is not picking up the datasource. Is there a step that I am missing?

2

2 Answers

1
votes

I'm not sure, but may be you should add this:

rvReport.Reset();

after

rvReport.LocalReport.DataSources.Clear();
0
votes

I ended up using a grid instead and writing an export for the grid, since the customer mostly just wanted to be able to export to Excel.