function
CloseOnReload() {
GetRadWindow().Close();
}
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
This is called by a CloseOnReload() script registered as a startup script when some action is performed.
6 Answers, 1 is accepted
The code should be executed in the radwindow page as described in the documentation here.
Executing Script on a Reload
If you want to close the window from parent page, then you need to access the window client object and invoke the close() method. Get the client object of window by using 'getWindowByName' method.
-Shinu.
First, thank you so much for your response. The radwindow is contained by the radwindow manager. I had to set
PreserveClientState
="true" on the manager in order to keep the window open when posting information from the window back to the server. The window is not accessing a separate page url, but is using a content template. When the done button (linkbutton) is clicked in the radwindow, if the page is valid, then I register the startup script to close the window. I have found that in the window show javascript function GetRadWindowManager() returns a reference to the radwindowmanager, but in the CloseOnReload, GetRadWindowManager returns null.
The getWindowByName or getWindowByID methods of the radwindowmanager will not work until I can get a reference to the RadWindowManager. I have looked at the source of the page and have found the client ID of the radwindow manager = <div id="ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl01_rgLinkList_ctl00_ctl02_ctl03_gceGenericContent_rwmManager" style="display:none;"> and the client id of the radwindow(there is only one): <div id="ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl01_rgLinkList_ctl00_ctl02_ctl03_gceGenericContent_rwContentEditor" style="display:none;">.
The id of each is rwmManager and rwContentEditor. Why would GetRadWindowManager() not return the manager reference? Is there some other method that should be used in the Javascript?
Thanks
Keith
The GetRadWindow() function is used to reference a RadWindow from inside its content page. In your case, however, the RadWindow and its content are all on the same page - that is why you should simply reference it as you reference a client object on the same page - by using the $find method.
Best wishes,
Svetlina
the Telerik team
Thank you for the reply. That suggestion did not work. On the debug of the javascript for the CloseOnReload function, the following $finds:
var
oManager = $find("<%= rwmManager.ClientID %>");
oManager.closeall();
var oWnd = $find("<%= rwContentEditor.ClientID %>");
oWnd.close();
Both returned null references. Neither the Manager nor the Window could be found.
If I do a search on the source control for each -> The Manager:
<div id="ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl01_rgLinkList_ctl00_ctl02_ctl03_gceGenericContent_rwmManager" style="display:none;">
And the window:
<div id="ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl01_rgLinkList_ctl00_ctl02_ctl03_gceGenericContent_rwContentEditor" style="display:none;">
Are both on the page.
Thanks
Keith
In such case, please open a support ticket and send us a small sample project / sample page(s) where this issue could be reproduced. This way we will get a better view over your exact setup and logic and we will provide you with a solution right away.
Thank you in advance for your cooperation.
Greetings,
Georgi Tunev
the Telerik team