This is a migrated thread and some comments may be shown as answers.

Firefox and child window

1 Answer 75 Views
Window
This is a migrated thread and some comments may be shown as answers.
juststarting
Top achievements
Rank 2
juststarting asked on 14 Jul 2010, 04:02 PM
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

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 16 Jul 2010, 11:21 AM
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
Tags
Window
Asked by
juststarting
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Share this question
or