I am trying to add a function to the close event of a nested radWindow.
There is a Main Window which has 'RadWindow1' inside it.
Then in the Loaded Page in RadWindow1, I have the following code, where I am opening a nested radWindow using radopen()
I can open the nested radWindow and run the application in the page loaded in it .
But I am getting this error in the application for the Close function --> "telerik Can't execute code from a freed script"
The function is right there and is so simple.
I can't figure out what is the issue as the function is in the parent (RadWindow1) and not the child.
So, if the parent (RadWindow1) is not terminated, how come the script is freed??
- The Code is as follows:
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
body>
<script type="text/javascript">
function GetRadWindow()
{
var oWindow = null;
if (window.radWindow)
oWindow = window.radWindow;
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
return oWindow;
}
function ShowNewRadWindow(stringUrl)
{
var oBrowserWnd = GetRadWindow().BrowserWindow;
var oWin = oBrowserWnd.radopen(stringUrl, null);
oWin.add_close(myAlert);
oWin.setActive(
true);
oWin.setSize (600, 500);
oWin.moveTo(100,100);
oWin.maximize();
alert(
"Please select the Errored records and Update them.");
}
function myAlert()
{
alert(
"Window is Closing......");
}
function OnClientClose(sender, eventArgs)
{
var hiddenPostBackField = document.getElementById("PostBackSourceHiddenField");
hiddenPostBackField.value = "ChildPostBack"
alert(
"Window is Posting Back.");
DoPostBack();
alert(
"Window is closing.");
}
function DoPostBack()
{
__doPostBack(
'ctl00_ContentPlaceHolder1_RadWindow1','My Argument');
}
</
script>
<form id="form1" runat="server">
<div style="width:100%;">
<%
-------------------------------------------------------------------------------------------------------------%>
<%
-- Hidden field to check postback of the page from the Confirm Window. --%>
<%
-------------------------------------------------------------------------------------------------------------%>
<asp:HiddenField ID="PostBackSourceHiddenField" Value="SelfPostBack" runat="server" />
<%
-------------------------------------------------------------------------------------------------------------%>
.
.
.
<asp:Button ID="btnOpen_NestedradWindowConfirmInsert" Font-Bold="true" runat="server" Font-Size="small"
Text="Review new Window" ForeColor="red"
OnClientClick ="ShowNewRadWindow('./PopupPage.aspx');" />
.
.
--------------Other Code-----------------
.
.
.
</div>
</form>
</
body>
</
html>