We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Pass Parameters from code behind

Hello,
I am trying to pass parameters from user to report viewer with the following:

            ReportWindow RW = new ReportWindow();
            string reportPath = System.IO.Path.Combine(new DirectoryInfo("reports").FullName, "takrir-tarbawi16.rdl");
            RW.ReportViewerControl.ReportPath = reportPath;
            List<ReportParameter> parameters = new List<ReportParameter>();
            ReportParameter parameter = new ReportParameter();
            parameter.Name = "FactNum";
            parameter.DefaultValue.Values.Add("456654");
            parameters.Add(parameter);

            RW.ReportViewerControl.SetParameters(parameters);
            RW.ReportViewerControl.RefreshReport();
            RW.Show();

Now I have an issue in compiling this, the error compiler sent:
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'System.Collections.Generic.List<Syncfusion.RDL.DOM.ReportParameter>' to 'System.Collections.Generic.IEnumerable<Syncfusion.Windows.Reports.ReportParameter>' TeacherReportWindow.xaml.cs 40 Active


3 Replies

BI BELADEL ILYES ABDELRAZAK July 31, 2017 12:42 AM UTC

It turns out that I am using diffrent refernce in another name space, now the code solved just by adding:

using Syncfusion.Windows.Reports;



VS Vinoth Srinivasan Syncfusion Team July 31, 2017 04:53 AM UTC

Hi BELADEL, 

Thanks for the update, we are glad that you have fixed the issue and please get back to us if you require any further assistance. 

Regards, 
Vinoth S. 



BI BELADEL ILYES ABDELRAZAK July 31, 2017 05:06 PM UTC

It's my duty to do that, thanks.


Loader.
Live Chat Icon For mobile
Up arrow icon