Dynamically enable or disable the report printing option on the client side
Hello Everyone, in this blog I am going to discuss about an interesting scenario while working on a customer issue recently related to Client Printing of SSRS Reports.
Let’s say you want to disable Client Side Printing on Reporting Services when you open your reports through your application on Internet Explorer. You use Report Viewer Control to view the reports on the client application. There is a setting in SQL Server Management Studio where you can toggle the parameter for EnableClientPrinting. We connect to the Report Server through SSMS - > Right – click on the name of the Report Server - > Advanced - > EnableClientPrinting - > You can choose this to be True or False. I have given a screenshot of the same below –
But the above setting is only for the SSRS / Report Manager application and does not affect Report Viewer Control which is a different entity altogether. You have disabled this setting in the above properties and expect the same setting to be applied for Report Viewer and you do not want to update your application code every time you enable or disable this setting.
To change the setting of the Print Icon in Report Viewer automatically, you can use this code snippet in your application code.
protected void Page_Load(object sender, EventArgs e)
//Your Report Sever URL and Path
String reportServerURL = "https://bi-sql-vm/ReportServer14";
String reportPath = "/HelloWorld";
// Report Viewer Configuration
ReportViewer1.ServerReport.ReportServerUrl = new Uri(reportServerURL);
ReportViewer1.ServerReport.ReportPath = reportPath;
// Report Service Configuration
ReportingService2010 rs = new ReportingService2010();
rs.Url = reportServerURL + "/ReportService2010.asmx";
rs.UseDefaultCredentials = true;
// Creating a Property Object to filter the System properties
Property reportServerProperties = new Property;
reportServerProperties = new Property();
reportServerProperties.Name = "EnableClientPrinting";
// Retrieving the System property for Client Printing
Property newReportServerProperties = rs.GetSystemProperties(reportServerProperties);
// Depending on the value configure at the Server Level, Report Viewer will be updated
if (newReportServerProperties.Value == "False")
ReportViewer1.ShowPrintButton = false;
ReportViewer1.ShowPrintButton = true;
// Refreshes the Report
This is the easiest way to dynamically enable or disable the report printing option on the client side as set in the report server property.
Any Sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. ANY SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANT ABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Author: Anshu Jana – Support Engineer, SQL Server BI Developer team, Microsoft
Reviewer: Selvakumar Rajakumar - Escalation Engineer, SQL Server BI Developer team, Microsoft