How to trap mouse click on RadWindow border ?

2 posts, 0 answers
  1. Vasssek
    Vasssek avatar
    190 posts
    Member since:
    Aug 2010

    Posted 24 May 2012 Link to this post

    Hello,

    I have one issue which is related to displaying pdf report in aspx page. In our company we couldn't use Adobe PDF Reader, that's why we can't use standard telerik ReportViewer. Instead of this I have to embed pdf object into aspx page and then from server side inject into this object generated report.

    <object><embed width="100%" type="application/pdf" id="pdfObject" runat="Server"></embed></object>

    My issue appears, when user clicks on border of opened radwindow. After that, radwindow is reopen second time and generated report is regenerated , too. Strange thing is, that this issue appears only on PC with Windows7 OS and IE 8 browser. On Win XP with IE8 or Windows 7 with IE 9 this issue didn't appear. 

    So I need to prevent reopening radwindow by cancelling mouse click on border on radwindow. Please could somebody point me, how can I trap mouse event when user clicks on radwindow border ?

    Here is my page code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Report_skladove_polozky_z_objednavky.aspx.cs"
        Inherits="_Default" Async="false" %>
     
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register Assembly="Telerik.ReportViewer.WebForms" Namespace="Telerik.ReportViewer.WebForms"
        TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <head id="Head1" runat="server">
        <%--<link href="~/Scripts/CSS/EditFormStyles.css" rel="stylesheet" type="text/css" />--%>
        <title>Tlačová zostava</title>
        <style type="text/css">       
            #AllPanel
            {
                width:100%;
                height:100%;
                margin:0px;
                padding:0px;
                font-family: Arial, Helvetica;
                font-size: 14px;
            }
             
            #AllPanel a
            {
                color: black;
                text-decoration: none;
            }
        </style>
     
        <script language="JavaScript" type="text/javascript">
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }
     
            function content_onkeydown(e) {      
                //alert("clicked in content page content");
                try {
                    if (!e) e = window.event;
                    if (e.keyCode == 27) {
               FocusOnRadWindow();
                       var oWindow = GetRadWindow();  //Obtaining a reference to the current window 
               oWindow.Close(); 
                    }
                }
                catch (err) { }       
            }       
     
            function FocusOnRadWindow() {
                GetRadWindow().GetContentFrame().contentWindow.focus();           
            }
     
            function secondFn() {
                window.setTimeout(function () {
                    var senderElementStyle = GetRadWindow().get_popupElement().style;
                    //alert(senderElementStyle.width + "   " + senderElementStyle.height);
                    document.getElementById("pdfObject").style.height = parseInt(senderElementStyle.height) - 63 + "px";              
                }, 0)
                window.setTimeout(function () {               
                    GetRadWindow().GetContentFrame().contentWindow.focus();
                }, 1000)
            }
     
            document.onkeydown = content_onkeydown;
    </script>
     
    </head>
    <body">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager2" runat="server">
        </asp:ScriptManager>
        <telerik:RadSkinManager ID="RadSkinManager2" runat="server" ShowChooser="false" Skin="Hay">
        </telerik:RadSkinManager
     
       <object><embed width="100%" type="application/pdf" id="pdfObject" runat="Server"></embed></object>
      
        </form>
    </body>
    </html>


    Thank you for your ideas.

    Best regards

    Vasssek 
  2. Vasssek
    Vasssek avatar
    190 posts
    Member since:
    Aug 2010

    Posted 25 May 2012 Link to this post

    Hello,

    I've solved described issue by myself. Thanks to this link: http://stackoverflow.com/questions/291813/best-way-to-embed-pdf-in-html I found the solution.

    I just replaced line:
    <object><embed width="100%" type="application/pdf" id="pdfObject" runat="Server"></embed></object>
    with
    <iframe style="width:100%; height:760px;" frameborder="0" id="pdfObject" runat="Server"></iframe>

    Now pdf report shows properly...

    Vasssek
Back to Top