ReportViewer - Hide PDF Export ReportViewer - Hide PDF Export asp.net asp.net

ReportViewer - Hide PDF Export


I had exactly the same problem and solved using the following C# method, found here!:

public void DisableUnwantedExportFormat(ReportViewer ReportViewerID, string strFormatName){    FieldInfo info;    foreach (RenderingExtension extension in ReportViewerID.LocalReport.ListRenderingExtensions())     {        if (extension.Name == strFormatName)        {             info = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);            info.SetValue(extension, false);        }    }}

and on the page_load:

DisableUnwantedExportFormat(ReportViewer1, "PDF");


This is how you disable a export option, just mark all the ones except Excel to false.
*Don't forget to restart the Reporting Services service.

File: InstallPath\Reporting Services\ReportServer\rsreportserver.config

Enabled:

<Extension Name="EXCEL"Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering"/>

Disabled:

<Extension Name="EXCEL"Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering"Visible="false"/>


This simple jQuery approach worked for me:

 $(document).ready(function () {     $("a[title='PDF']").parent().hide();  // Remove from export dropdown.     $("a[title='MHTML (web archive)']").parent().hide();       $("a[title='TIFF file']").parent().hide();   });