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

Call JavaScript in child window not work

3 Answers 114 Views
Window
This is a migrated thread and some comments may be shown as answers.
adi
Top achievements
Rank 1
adi asked on 30 Apr 2009, 04:26 PM
Hi,

I'd like to open a RadWindow in parent page and call a function in the new opened RadWindow. I've taken the sample Calling Functions in Windows (http://www.telerik.com/help/aspnet-ajax/window_programmingcallingfunctions.html). But if I call the function in parent page I get this error: Object doesn't support this property or method. It looks like there is no function declared. But it is. Here is my code:

parent:

 

function onNewEntry(sender, title) {

 

 

    var oWnd = $find("<%= RadWindow1.ClientID %>");

 

 

    oWnd.set_offsetElementID(sender.id);

 

    oWnd.show();

 

    var nWnd = $find("<%=RadWindowManager1.ClientID %>").GetActiveWindow();

 

    nWnd.get_ContentFrame().contentWindow.CalledFn(args);

}

on target page:

<
body>

 

 

<form id="form1" runat="server">

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

 

 

<asp:HiddenField ID="HiddenField1" runat="server" />

 

 

 

 

 

 

<script type="text/javascript">

 

 

 

 

 

 

    function CalledFn(args) {

 

 

        var hf = $find("<%= HiddenField1.ClientId %>");

 

        hf.value = args;

       }

 

 

</script>

 

 

 

 

 

 

</form>

 

</

 

body>

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 01 May 2009, 11:36 AM
Hello adi,

The reason for the problem is that you try to access the content page while it is still being loaded - I suggest to access it in the OnClientPageLoad function instead.



Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
adi
Top achievements
Rank 1
answered on 02 May 2009, 11:34 AM
Thanks, it works for me. But I have an other effect now. My RadWindow is placed inside an user control. If the window opened it will remain a second or two and still disappears then. I don't know why.
0
adi
Top achievements
Rank 1
answered on 02 May 2009, 11:51 AM
Okay. I didn't cancel the event.
Tags
Window
Asked by
adi
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
adi
Top achievements
Rank 1
Share this question
or