views:

818

answers:

3

I have an RDLC with multiple tables and for each table, I have a toggle TextBox Item that hides the corresponding table from the report. It works perfectly, however, I don't want these text boxes to be visible in the printed/exported reports. They are really meant for disabling content in the report and not as content themselves. Is there a way to hide those toggle boxes from only Print Layout and exported versions of the report?

I looked at all of the properties of the report textbox and at the available expressions that I can use to toggle visibility, but I didn't find anything that I can use to hide the item. There is a DataElementOutput property that seems to be what I want, but I believe that it is only useful for XML.

A: 

You can do some hacks to try to accomplish that like: - setting the text and border on your TextBox to be white so they are not vislble but still clickable - make report bigger than print size (paper size) and move your textboxes out of the print area (they will be printed/exported but not on the same page like your tables) - put your textboxes on top and design them to look like tabs which enable different views (I know, I know, this is not what you asked for :-) )

But the best way to solve this is to split your report in to several reports - for each table one report.

hope this helps!

cheers,

Pero

Perica Zivkovic
A: 

Late, but there are one solution. You can add a parameter to the report for handle control visibility and in the Print event, change the parameter value and then refresh the report (ReportViewer1.RefreshReport())

Hugo