Click here to Skip to main content
16,016,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am beginner of .rdlc report..

I have a TextBox in my .rdlc report.
I have placed the report in my Default.aspx page (within report viewer).

How can I pass a value from Default.aspx.cs to .rdlc-TextBox (to display in textBox)?

(Expecting something like: this.ReportViwr.Report1.TextBox1.Text="SomeValue")
Posted
Updated 5-Dec-17 9:33am
v2

 
Share this answer
 
Comments
Espen Harlinn 17-Jul-11 16:54pm    
Number 2 is obviously spot on, my 5
Hi and sorry for my english.

You can use a ReportParameter Like this :

C#
List<ReportParameter> ListParameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter();
parameter .Name = "name";
parameter.Values.Add("Value");
reportViewer1.LocalReport.SetParameters(ListParameters);


In the report.rdlc, you will just add a new parameter with name "name".
 
Share this answer
 
1.Go to the rdlc Design view
2.on the report data view (On the left) select parameters
3.Right click Add
4.set the name (best you Check Allow blank and allow null value)click OK

5.add the textfiled value OR select one from your tablix,right click and select Expression
6.set the expression e.g
=Parameters!title.Value


7.In your form that contains your report view add the following lines for a single parameter

ReportParameter rp = new ReportParameter("title", title);

          this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
         });



          reportViewer1.RefreshReport();

8.for multiple parameters
ReportParameter rp = new ReportParameter("title", title);
          ReportParameter rps  = new ReportParameter("expense", totalExpense.ToString());
          this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
          this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rps });



          reportViewer1.RefreshReport();
 
Share this answer
 
Comments
CHill60 5-Dec-17 15:48pm    
Although your solution appears to be well thought out, you may get down voted because the question has an accepted answer from over 6 years ago.
It's best to stick to answering new questions where the OP still needs help
were douglas 20-Jan-18 20:55pm    
thx

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