Modify the ReportViewer toolbar RRS feed

  • Question

  • User-430413477 posted

    I am using a reportviewer control in a webpage. This is using the embedded report.
    I'd like to change the Export portion of the toolbar to only show PDF and I'd like to change the text from "Export" to Print.

    Does anyone know how?

    Because if I.....
    set the ExportContentDisposition property to AlwaysInLine and
    set the format to PDF and
    click the export

    It behaves just like a print and works good in all browsers since the print icon does not show in all browsers..

    So if I could modify the toolbar no one would know it is not a print except it goes to PDF.



    Friday, September 2, 2011 4:48 PM


  • User-1438587911 posted

    Oh wow, good idea. Never thought about that...

    You could use jQuery:

    $('#ctl00_cphBody_rv1_ctl05_ctl04_ctl00_Menu').children('div:lt(2)').css('display', 'none');
    $('#ctl00_cphBody_rv1_ctl05_ctl04_ctl00_Menu').children('div:gt(2)').css('display', 'none');


    Or, better yet... you could create your own print control and append it to the Report Viewer toolbar yourself. And not even use the export controls:
    Add a linkButton or use an <a> tag or whatever, to your page:

    <asp:LinkButton ID="lnkPrintPDF" runat="server" Height="15" Width="24" ToolTip="PrintPDF" OnClientClick="$find('ctl00_cphBody_rv1').exportReport('PDF');return false" />

    Add a pageLoad() event to handle the appending of the above control to the report viewer toolbar:

    function pageLoad() {
        var lnkPrintPDF = $('#ctl00_cphBody_lnkPrintPDF');
        reportBar = $('#ctl00_cphBody_rv1_ctl06').children('div');
        if (reportBar.length > 0 && lnkPrintPDF) {
            reportBar.append(lnkPrintPDF.css('visibility', 'visible'));
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 6, 2011 3:24 PM