Disable right mouse click

5 posts, 2 answers
  1. JK
    JK avatar
    123 posts
    Member since:
    Sep 2007

    Posted 12 May 2008 Link to this post

    Hi,

    I am using Q1 reporting with ASP.  Specifically, I have created a report within a radwindow which works well, however, you can right click anywhere on the preview and it brings up the full IE quick menu.

    I tried to remove this by adding the basic javascript code to disable right clicking but it worked outside of the report but not on the report itself.

    Is there any way of restricting the right mouse click?

    Thanks,

    Jon
  2. Answer
    Chavdar
    Admin
    Chavdar avatar
    898 posts

    Posted 13 May 2008 Link to this post

    Hi JK,

    At this moment there is no way to disable the context menu in the report area. It renders as an iframe element and you cannot add custom javascript code to the document which is shown there. We will put down your request and will try to think of a possible solution for achieving this functionality.

    Let us know if other questions/problems come to mind.

    Best wishes,
    Chavdar
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. DevCraft banner
  4. AJ
    AJ avatar
    3 posts
    Member since:
    Feb 2011

    Posted 22 Mar 2012 Link to this post

    Has there ever been any update to this? I'm finding that some people are right clicking the report and going to print and it's coming out as blank pages.
  5. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 27 Mar 2012 Link to this post

    Hello AJ,

    You can easily achieve this with the help of some javascript:

    <telerik:ReportViewer ID="ReportViewer1" runat="server" />
     
      <script type="text/javascript">
          ReportViewer.prototype.OnReportLoadedOld = ReportViewer.OnReportLoaded;
          ReportViewer.prototype.OnReportLoaded = function () {
              this.OnReportLoadedOld();
     
              var reportFrame = document.getElementById(this.reportFrameID);
              var reportDocument = reportFrame.contentWindow.document;
              var body = reportDocument.getElementsByTagName("body")[0];
              body.oncontextmenu = function () { return false; };
          }
      </script>


    Kind regards,
    Steve
    the Telerik team
    NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
  6. AJ
    AJ avatar
    3 posts
    Member since:
    Feb 2011

    Posted 29 Mar 2012 Link to this post

    That was easy. Thanks!!!!
Back to Top
DevCraft banner