• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2076
  • Last Modified:

asp .net 4 C#: Problem making a hidden ReportViewer visible when clicking a button.

Using Visual Studio 2010, I have a web page with a working ReportViewer connected to a SQL DB. I now want to have that control hidden until a user clicks a button.

I have set the ReportViewer visible property to false, created a button, and have written in it's click event myReportViewer.visible = true;

Run it, but nothing happens when clicking the button. What else do I have to do to make the reportviewer visible and refresh it's data?
  • 2
1 Solution
Does it appear that the event is being called when you click on the button, in other words can you see that the page refreshes?
MyNameIsIvanAuthor Commented:
Yes, the event is being reached because I also changed the text of the button which is successful when run.

Nevertheless, I've found the solution myself...

After making the ReportViewer visible in my button even, add these two lines:

ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
            ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

The problem is due to a bug in the viewer which is explained well here (although he toggles it the wrong way around in his example): http://blogs.msdn.com/b/brianhartman/archive/2010/11/16/the-invisible-reportviewer.aspx

All works now, but thanks anyway!
MyNameIsIvanAuthor Commented:
See my above comment

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now