Call JavaScript in child window not work

4 posts, 1 answers
  1. adi
    adi avatar
    81 posts
    Member since:
    Feb 2007

    Posted 30 Apr 2009 Link to this post

    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>

     

  2. Answer
    Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 01 May 2009 Link to this post

    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.
  3. adi
    adi avatar
    81 posts
    Member since:
    Feb 2007

    Posted 02 May 2009 Link to this post

    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.
  4. adi
    adi avatar
    81 posts
    Member since:
    Feb 2007

    Posted 02 May 2009 Link to this post

    Okay. I didn't cancel the event.
Back to Top