dynamicuser
dynamicuser

Reputation: 1552

Data sources empty on ReportViewer

I'm trying to link up my report viewer to the data sources, however the dialog box is empty -

Empty dialog box

I have a file called dsReports.xsd which has data sets that work when I preview data from there. Anyone know why this could be?

Thanks

Upvotes: 5

Views: 5494

Answers (3)

SZL
SZL

Reputation: 855

The problem is that you probably save your report with newer version of Visual Studio (in my case with Visual Studio 2019). After save, the data source list will be empty in the "Choose Data Sources" section.

When I edit my original report with older version of Visual Studio the data source list shown.

(in my case a saved report cannot be restored neither with older version of VS, so I hope you have a backup :) )

Upvotes: 0

Diego Venâncio
Diego Venâncio

Reputation: 6007

This problem occur when yourfile.rdlc not have add a DATASET like "source data". Then, add a table in your report .rdlc and configure the after try add datasource in rsweb:ReportViewer dont forget of put a ScriptManager a .aspx.

Upvotes: 0

dynamicuser
dynamicuser

Reputation: 1552

I have got round this by programatically setting the data source -

var myDataTable = new dsReports.tsPrimaryMondayDataTable();
        var myTableAdapter = new dsReportsTableAdapters.tsPrimaryMondayTableAdapter();
        myTableAdapter.Fill(myDataTable, Convert.ToDateTime(dtp.Value));
        var rds = new ReportDataSource("DataSet1", myDataTable as DataTable);

        reportViewer1.LocalReport.DataSources.Clear();
        reportViewer1.LocalReport.DataSources.Add(rds);
        reportViewer1.RefreshReport();

Upvotes: 2

Related Questions