locked
Printing report in a webviewer RRS feed

  • Question

  • User-430413477 posted

    I am using the report viewer in a webpage.

    Is there any way to disable the print icon in the tool bar AFTER the user has clicked on it?

    Or putting it another way, is there anyway to allow only clicking once on the print icon.

    The work around or soultion does not have to be pretty or elegant, just functional.

    Even if I put a button on the page that programmatically prints the report?

    Thanks

     

    Saturday, August 27, 2011 6:22 AM

All replies

  • User-1438587911 posted

    I'm thinking one way would be as follows:

    Add a beginPageRequest to the page in the documentReady funciton:

    $(document).ready(function () {
       Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
    });

     

    Add the beginRequest function:

    var printedAlready = 0
    function beginRequest(sender, args) {
       if (sender._postBackSettings.sourceElement.name.indexOf('ctl00$cphBody$rv1$ctl05$ctl06$ctl00$ctl00$ctl00') > 0) {
          if (printedAlready = 1) {
             return false;
          } else {
             printedAlready = 1
          };
        };
    };

     Let me know if this works will you

    Tuesday, September 6, 2011 6:00 PM