Hi
We’re having problems with our GetRadWindow procedure when closing radwindows.
In the below example, we have a main navigation page (denoted by default.aspx), a page that is opened from default.aspx (denoted by window1.aspx) and a page that can be opened from window1.aspx (denoted by window2.aspx).
As a window is closed, we anticipate the activate event will fire of the remaining window, which it appears to if we close window 2 before window 1. However, if we close window 1 first, window 2 reports that GetRadWindow is not defined in the Activate event.
I'm sure I'm doing something stupid, but I just can’t see what it is. Any help would be much appreciated.
Default.aspx
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="CascadingWindows_Default" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <!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 language="JavaScript" src="Jscript.js" type="text/javascript"></script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <telerik:RadScriptManager ID="ScriptManager" runat="server"></telerik:RadScriptManager> |
| <telerik:RadWindowManager ID="WindowsManager" runat="server" DestroyOnClose="true" VisibleStatusbar="false"></telerik:RadWindowManager> |
| <input id="Button1" type="button" value="Open Window 1" onclick="WindowOpen('Window1.aspx')" /> |
| </form> |
| </body> |
| </html> |
Window1.aspx
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Window1.aspx.vb" Inherits="CascadingWindows_Window1" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <!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 language="JavaScript" src="Jscript.js" type="text/javascript"></script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <h1>Window 1</h1> |
| <div> |
| <input id="Button1" type="button" value="Open Window 2" onclick="WindowOpen('Window2.aspx')" /> |
| </div> |
| </form> |
| </body> |
| </html> |
Window2.aspx
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Window2.aspx.vb" Inherits="CascadingWindows_Window2" %> |
| <!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 language="JavaScript" src="Jscript.js" type="text/javascript"></script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <h1>Window 2</h1> |
| </form> |
| </body> |
| </html> |
Jscript.js
| function GetRadWindow() { |
| if (window.radWindow) return window.radWindow; |
| else if (window.frameElement != null && window.frameElement.radWindow) return window.frameElement.radWindow; |
| return null; |
| } |
| function WindowActivate(sender, eventArgs) { |
| var oRadWindow = GetRadWindow(); |
| /* More code removed for this example */ |
| } |
| function WindowOpen(windowUrl) { |
| var oRadWindow = GetRadWindow(); |
| var oManager = null; |
| if (oRadWindow == null) { oManager = GetRadWindowManager(); } |
| else { oManager = oRadWindow.BrowserWindow.GetRadWindowManager(); } |
| if (oRadWindow == null) { oWnd = radopen(windowUrl, null); } |
| else { oWnd = oRadWindow.BrowserWindow.radopen(windowUrl, windowUrl);} |
| oWnd.add_activate(WindowActivate); |
| } |
