I\'m using the following code trying to SetParametr :
var report = new ReportParameter[1];
report[0] = new ReportParameter(\"MyName\", \"Raha\");
I found myself stuck with the same error, and the reason is actually quite simple: the Report Definition must be set in the first place, before the parameters. This way, the LocalReport
can check if they are really mandatory and eventually throw an exception.
The code below should work:
_reportViewer.LocalReport.DataSources.Add(reportDataSource1);
_reportViewer.LocalReport.ReportPath = "../../Report1.rdlc";
_reportViewer.ServerReport.SetParameters(report);