[CLOSED] [1.3] Window.close() causing 'Microsoft JScript runtime error: 'Ext' is undefined' error when called from an IFRAME

  1. #1

    [CLOSED] [1.3] Window.close() causing 'Microsoft JScript runtime error: 'Ext' is undefined' error when called from an IFRAME

    Hi, I'm creating a new window and trying to invoke the close method of that window from the resulting IFRAME using the close method on the parentAutoLoadControl object. When doing this I'm getting the 'Microsoft JScript runtime error: 'Ext' is undefined' error. When I call the hide method I do not have issues. I've also tried closing the window down from the parent and things are fine so I can only assume this is something to do with killing of the window from which the click originates.

    This appears to function correctly in Chrome, I haven't tested FF but isn't working in IE9. I'm also using Ext.net v1.3

    I've included code for both the Parent and Child below. Any help would be great.

    Thanks,

    Gav

    Parent Page
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ClientSideWindowLoader.aspx.vb"
        Inherits="ASPSandbox.ClientSideWindowLoader" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            function loadWindow() {
                var win = new Ext.Window({
                    width: 400,
                    id: 'autoload-win',
                    height: 300,
                    autoLoad: {
                        url: 'ChildContent.aspx',
                        mode: 'iframe'
                    },
                    title: 'test'
                });
                win.show();
            }
    
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="Server">
        </ext:ResourceManager>
        <ext:Button ID="Button1" runat="server" Text="Create Window">
            <Listeners>
                <Click Fn="loadWindow" />
            </Listeners>
        </ext:Button>
        
        <ext:Button ID="Button2" runat="server" Text="Close Window">
            <Listeners>
                <Click Handler="Ext.WindowMgr.get('autoload-win').close();" />
            </Listeners>
        </ext:Button>
    
    
        </form>
    </body>
    </html>
    Child Page
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ChildContent.aspx.vb"
        Inherits="ASPSandbox.ChildContent" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
        <ext:Button ID="Button2" runat="server" Text="Close Me">
            <Listeners>
                <Click Handler="parentAutoLoadControl.close();/*parentAutoLoadControl.hide();*/" />
            </Listeners>
        </ext:Button>
        </form>
    </body>
    </html>
    Last edited by Daniil; May 08, 2012 at 4:37 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please set up a small delay.
    <Click Handler="parentAutoLoadControl.close();" Delay="1" />
    I think it happens due to the difference in JavaScript browsers engines. IE often requires a small delay in such cases.
  3. #3
    Wow, how I've missed that for so long is beyond me but that fixes it. You can mark this ticket as closed.

    Thanks!

Similar Threads

  1. Replies: 5
    Last Post: Mar 16, 2012, 3:47 PM
  2. Replies: 2
    Last Post: Jul 18, 2011, 11:17 PM
  3. Replies: 3
    Last Post: Feb 14, 2011, 2:36 PM
  4. Microsoft JScript runtime error: 'Ext' is undefined
    By Satyanarayana murthy in forum Open Discussions
    Replies: 11
    Last Post: Mar 31, 2010, 12:54 PM
  5. Replies: 7
    Last Post: Mar 11, 2010, 4:01 PM

Tags for this Thread

Posting Permissions