Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all.
I have a form with a textbox and a button that opens a form containing an RDLC report. Is there a way to pass the value entered in the text box to the RDLC report in order to use it calculations?

Thanks a lot for any kind help.

Form Load code
this.reportViewer1.LocalReport.ReportEmbeddedResource = “TestReport.Report1.rdlc”;
ReportParameter rp = new ReportParameter(“content”, this.textBox1.Text);
this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
this.reportViewer1.RefreshReport();


---------------------------------------------------------------
VS2010 says
The type or namespace name 'ReportParameter' could not be found (are you missing a using directive or an assembly reference?)

---------------------------------------------------------------
Please Help.....
thanks in advance....!!
Posted

1 solution

As mentioned here[^], for RDLC:
C#
ReportViewer1.LocalReport.ReportPath  ="~/Report1.rdlc";
ReportParameter[] Parameters = new ReportParameter[1];

Parameters[0] = new ReportParameter("LastName", Convert.ToString(LastNameDropDownList.SelectedValue));
ReportViewer1.LocalReport.SetParameters(Parameters);
 
Share this answer
 
Comments
Member 8099391 10-Jul-13 6:34am    
thank you...~~

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900