I am trying to load an (.rdl) report file into a web report viewer control (visual studio 2010 control):
//Get the data and
.
.
//Add it to report
ReportViewer.LocalReport.DataSources.Add(new ReportDataSource(element.Name, dt));
//Pass the report to the viewer
using (FileStream stream = new FileStream(ReportDocument.FileName, FileMode.Open))
{
this.ReportViewer.LocalReport.LoadReportDefinition(stream);
}
Am I missing a line of code somewhere? I used the equivalent for the winforms report viewer with the addition of RefreshReport() – however there is no equivalent method that I could find for web report viewers). The page remains blank – what am I missing?
Best Answer
There is a
.Refresh()
method, and that is what you are missing. Here's what I'm using (in VB):