How to disable a export in Report Viewer RRS feed

  • Question

  • User-1725420302 posted

    Dear all,

    I am using Report Viewer to view the report in Sql Reporting Service 2008R2.

    I want to disable a export(ex:Excel,PDF) of ReportViewer in code behind.

    I try some code for Report Viewer like that :

    var info = extension.GetType().GetField("m_serverExtension", BindingFlags.NonPublic | BindingFlags.Instance);
                if (info != null)
                    var rsExtension = info.GetValue(extension) as OldVer::Microsoft.SqlServer.ReportingServices2005.Execution.Extension;
                    if (rsExtension != null)
                        rsExtension.Visible = false;
                    //info.SetValue(extension, false);

    But seem it does work with Report Viewer

    Can you please help me a solution to disable  a export in Report Viewer ?

    Thank you very much.

    Friday, July 19, 2013 5:11 AM


  • User-1185172246 posted

    I think you should do that through javascript code. Leave ReportViewer to render at a page and analyze the HTML code it generates. Then use jQuery to hide the elements related to Export feature.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 19, 2013 7:11 PM