Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a report drawn through SSRB 3.0. The report is of the .rdl type so through VB.NET code and Report Viewer is hooked and displayed. The data set is managed dynamically so that records can be filtered according to the user's needs.

The report is very simple has:

a page header with a text box (TestataREp) with the value: 'ACTIVITY LIST';
in the body a table that displays the records according to the dataset;
a footer with the numbering of the pages.
Since the data to be displayed are filtered according to the user's choices, I would like to be able to dynamically change the value of the textbox (the Header) in the page header or with another text box as a dynamically editable subtitle from code vb.net, but I do not know how to do it.

What I have tried:

<pre>In practice I would like, for example, that the header could be changed, via code vb.net, from 'ACTIVITY LIST' to 'ACTIVITY LIST of the xxxx group' or in 'LiST PERSONAL ACTIVITIES' etc. etc. I don't know if I could explain myself. Thank you for any useful advice.
Posted
Updated 17-Jan-22 2:07am

1 solution

If you want to set the header via code, the simplest option is to add another parameter, pass the required title in that parameter, and set the text box's text to that parameter.

Otherwise, you could use an expression for the text box parameter, and built the title within the report itself.
 
Share this answer
 
Comments
alip1 17-Jan-22 9:48am    
Thank you very much Richard
Can you help me understand how in practice I have to do this?
Suppose that in Project .rdl Report (made with Report Builder 3.0) it has a textbox in the page header with name: txtGroup and that in the report it has defined a parameter @Group.
Now I know how to attach the parameter to the textbox, but I don't know how to pass a value to the parameter via code: I have the listbyGroup object as a report object.
Can you point me to a code snippet (in vb.net or c#) to figure out how to do it?
I would be really grateful.
Richard Deeming 17-Jan-22 10:08am    
You call the SetParameters method on the ServerReport instance. Eg:
ReportParameter[] reportParameter = new ReportParameter[1];
reportParameter[0] = new ReportParameter("Group", "The value of the parameter...");
serverReport.SetParameters(reportParameter);
Maciej Los 17-Jan-22 12:00pm    
5ed!
alip1 18-Jan-22 3:59am    
Thank Marciej

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