Say the following line in that voice of the guy that announces monster truck rallies:
Are you ready for code that is going to BLOW YOUR MIND????
Too bad, because you’re getting this instead.
I was tasked to make the Reporting Services ReportViewer control look the same as the one in Report Manager. The ReportViewer looked like this:
And reports in Report Manager looked like this:
Most of the work was done with ReportViewer, removing buttons or rearranging them. So in the code behind for the page that held the ReportViewer (and in the following code, “rvReport” is a Microsoft.Reporting.WinForms.ReportViewer control):
ToolStrip toolStrip = (ToolStrip)rvReport.Controls.Find(“toolStrip1”, true);
ToolStripItem refresh = toolStrip.Items;
ToolStripItem print = toolStrip.Items;
ToolStripItem export = toolStrip.Items;
for (int i = 0;i < 10; i++)
What? What’s with calling RemoveAt(7) ten times? Well, there were ten controls that needed to be removed between the page navigation arrows on the left side of the ReportViewer and the zoom control. I know, it doesn’t look like there are ten, but there are.
But my important, life-changing work wasn’t done. No no, there was more fun to be had because the Atom feed button was still lurking on the Report Manager screen. So to get rid of that travesty, I had to change the Report Server configuration file, HtmlViewer.css. My file was located at C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\Styles.
Track down the ToolbarAtomDataFeed style and change it’s display from inline to none:
You’re probably out of breath because of the non-stop excitement that was this post. But you can get a breather now, until the next awesome post. Enjoy the rest.