Firefox and child window

2 posts, 0 answers
  1. juststarting
    juststarting avatar
    18 posts
    Member since:
    Jul 2012

    Posted 14 Jul 2010 Link to this post

    Hi,

    I have an application that has a master page, from which I open a radwindow (radwindowmanager on master page) 
    with more information. Once the client is happy and save the info, a 2nd radwindow (radwindowmanager on 1st radwindow page) opens in the 1st radwindow to confirm the date. When the client selected the date, the 2nd window pass the selected date back to the the 1st radwindow and close the 2nd window.

    This all works wonderfull in Opera, IE8 & Chrome, however in Firefox the radwindows open as it should, but once the date is selected, it does not pass the data back to the 1st radwindow, and it does not close either. Also in FireFox the scrollbar for the 1st radwindow is still active where in the other 3 browsers its disabled as the radwindow is modal.

    Code in 1st radwindow:
    function GetRadWindow() {
        var oWindow = null;
        if (top.radWindow) oWindow = top.radWindow; //Will work in Moz in all cases, including clasic dialog
        else if (top.frameElement.radWindow) oWindow = top.frameElement.radWindow; //IE (and Moz az well)
        return oWindow;
    }
    function CloseOnReload() {
        GetRadWindow().Close();
    }

    aspx in 2nd radwindow:
        <script language="javascript" type="text/javascript">
            //<![CDATA[
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
                return oWindow;
            }
     
            function CloseOnReload() {
                GetRadWindow().Close();
            }
            //]]>
        </script>
     
    <body style="background:#bbdbb4;">
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server" />
            <telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" DecoratedControls="Buttons" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
            <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Forest" />
     
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">
                <div style="position:absolute; left:0px; top:0px;">
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr><td colspan="2"><asp:Label ID="InjectScript" runat="server" Text="" /></td></tr>
                        <tr>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text="Date :" Width="100%"></asp:Label>
                            </td>
                            <td>
                                <telerik:RadCalendar ID="RadCalendar1" Runat="server"
                                    CultureInfo="English (South Africa)" EnableMultiSelect="False" SelectedDate="" 
                                    ViewSelectorText="x" AutoPostBack="True">
                                    <SpecialDays>
                                        <telerik:RadCalendarDay Date="2010-05-25" IsSelectable="False" IsDisabled="true">
                                        </telerik:RadCalendarDay>
                                    </SpecialDays>
                                </telerik:RadCalendar>
                            </td>
                        </tr>
                    </table>
                </div>
            </telerik:RadAjaxPanel>
     
            <div>
                <table width="100%" cellpadding="0" cellspacing="0" border="0" >
                    <tr><td colspan="2"> </td></tr>
                    <tr>
                        <td ><asp:Label ID="label2" runat="server" Text="Amount :" Width="100%" /></td>
                        <td><asp:TextBox ID="txtAmount" runat="server" /></td>
                    </tr>
                    <tr>
                        <td> </td>
                        <td> </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <center>
                                <asp:Button ID="cmdSave" runat="server" Text="Save" />
                                <asp:Button ID="cmdCancel" runat="server" Text="Cancel" />
                            </center>
                        </td>
                    </tr>
                </table>
            </div>
        </form>
    </body>
    </html

    code behind in aspx.vb (2nd radwindow):
    Protected Sub cmdSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSave.Click
        Dim javaInjection As String = ""
        javaInjection = "<" + "script language='javascript' type='text/javascript'>"
        javaInjection = javaInjection + "window.parent.form1.txtDate.value='" + Me.RadCalendar1.SelectedDate + "';"
        javaInjection = javaInjection + "window.parent.form1.txtAmount.value='" + Me.txtAmount.Text + "';"
        javaInjection = javaInjection + "CloseOnReload();"
        javaInjection = javaInjection + "window.parent.form1.submit();"
        javaInjection = javaInjection + "</" + "script>"
     
        Me.InjectScript.Text = javaInjection
    End Sub
     
    Protected Sub cmdCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
        Dim javaInjection As String = ""
        javaInjection = "<" + "script language='javascript' type='text/javascript'>"
        javaInjection = javaInjection + "window.parent.form1.txtDate.value='';"
        javaInjection = javaInjection + "window.parent.form1.txtAmount.value='';"
        javaInjection = javaInjection + "Window.parent.form1.frmTask.value='';"
        javaInjection = javaInjection + "CloseOnReload();"
        javaInjection = javaInjection + "</" + "script>"
     
        InjectScript.Text = javaInjection
    End Sub

    Thanks
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 16 Jul 2010 Link to this post

    Hi juststarting,

    Make sure that the JavaScript is actually called - you can do that by putting a simple alert in the function. In addition, I would not recommend to use label for injecting scripts in ASP.NET AJAX scenario - see this blog post for more details on the subject.

    Greetings,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top