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?
MyNameIsIvanAsked:
Who is Participating?
 
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!
0
 
gavsmithCommented:
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?
0
 
MyNameIsIvanAuthor Commented:
See my above comment
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.