I have made a SSRS rdl report which works well independently.
I need to run this report under my MVC project and set the Data-source to an IEnumerable
So far I've done this in my controller (with no luck):
var DataSetCity = dbContext.Cities.Where(p=>p.Id<5).ToList();
ReportViewer r = new ReportViewer()
{
ProcessingMode = ProcessingMode.Remote,
SizeToReportContent = true,
Width = Unit.Percentage(100),
Height = Unit.Percentage(100)
};
r.ServerReport.ReportPath = "/WaterReportServer/Report3";
r.ServerReport.ReportServerUrl = new Uri("http://desktop-v4c0kc2/ReportServer/");
ReportDataSource dataSource = new ReportDataSource("DataSet2", DataSetCity);
r.LocalReport.DataSources.Clear();
r.LocalReport.DataSources.Add(dataSource);
ViewBag.RP = r;
return View();
This code shows me a rendered report with original dataset that I used to design the report.
Is it possible to set my SSRS report dynamically ?