function CloseRadWindow()
{
var oManager = parent.GetRadWindowManager();
var oWnd = oManager.getActiveWindow();
if (oWnd != null)
{
oWnd.close();
}
return false;
}
RadWindowManager is present on the parent page.
This code works fine (closes the radWindow if we do not make any AjaxRequest to searver side).
Do we have any work around to fix this Issue?
6 Answers, 1 is accepted
The provided information was not enough for me to recreate your scenario. Could you please open a new support ticket and send me runnable project which shows the problem? I will check it and do my best to provide a working solution as soon as possible.
Greetings,
Fiko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I opened Radwindow from Parent Window.
Radwindow opening fine. After close Radwindow, i have to call javascript function in parent window. for that i used below code:
codebehind in Radwindow :
--------------------------------
public void btnAddtoCaseSheet_Click()
{
Response.Write("<script language='javascript'>GetRadWindow().BrowserWindow.RefreshCaseHistory();</script>");
or
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "refreshParent();", true);
}
Javascript in Radwindow:
-------------------------------
<asp:Button ID="btnAddtoCaseSheet" runat="server" Text="Add to CaseSheet"
OnClientClick="Close()" onclick="btnAddtoCaseSheet_Click"/>
<script language ="javascript" type ="text/javascript" >
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.RadWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow; //IE (and Moz as well)
return oWindow;
}
function refreshParent() {
// caseHistory() function is ParentWindow Javascript function
GetRadWindow().BrowserWindow.CaseHistory();
}
function Close() {
GetRadWindow().Close();
}
</script>
but i am getting below error.
"Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method"
i am searching to resolve this error for the last 3 weeks. but, i didn't get... pls give reply ASAP.
Thanks and Regards,
Srikanth.
In your code, you use the OnClick and OnClientClick properties. In OnClientClick (which is executed first) you close the RadWindow and then try to execute a code from that same page that you closed (in OnClick's server event) which will lead to problems like this one.
If you need to use the server event of the button, remove the OnClientClick property and close the RadWindow in the refreshParent() function.
e.g.
function refreshParent()
{
GetRadWindow().BrowserWindow.CaseHistory();
GetRadWindow().close()
}
If you don't need the trip to the server, cancel the postback (OnClientClick = "Close(); return false;") and again call the function on the parent and close the RadWindow in the same order.
e.g.
function Close()
{
GetRadWindow().BrowserWindow.CaseHistory();
GetRadWindow().close()
}
Best wishes,
Georgi Tunev
the Telerik team
Thanks for your reply. But,no luck.... still i am getting same Javascript run-time error.
As you said,i removed OnclientClick property and close the RadWindow in the refreshParent() function.
e.g.
function refreshParent()
{
GetRadWindow().BrowserWindow.CaseHistory();
GetRadWindow().close()
}
code behind :
-----------------
ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "refreshParent();", true);
Thanks and Regards,
Srikanth.
if i use below code in code-behind, i am getting "Microsoft JavaScript run-time error: Object expected" .
Response.Write("<script language='javascript'>GetRadWindow().BrowserWindow.CaseHistory();</script>");
" CaseHistory" function is parent-window JavaScript function.
Thanks and Regards,
Srikanth.
Make sure that the JavaScript function that you try to call is actually executed - for example you could put a simple alert in the beginning of the refreshParent() function and see if it is called again. Once ensure that the alert is shown, your code should work without problems.
If you still experience problems with this solution, please open a support ticket and send a sample project so we can investigate further.
Greetings,
Georgi Tunev
the Telerik team