Prava kafle
Top achievements
Rank 1
Prava kafle
asked on 01 Oct 2012, 07:19 PM
Hi,
I want to hide Radwindow from external javascript file, I tried various ways to hide Radwindow(without Radwindowmanager) but could not hide it completely. With " $find(delWindow).hide();" I was able to hide Radwindow but it did not hide the semitransparent overlay.
How can I call close()/hide() method on a Radwindow from external file?
$find(delWindow).hide();
$telerik.$("[id$='NGDeleteWindow']").hide(); .
//Hide Delete Window
function NGCloseDeleteWindow() {
var id = $telerik.$("[id$='DeleteWindow']").attr("id");
var delWindow = $find(id);
$find(delWindow).hide(); //$telerik.$("[id$='NGDeleteWindow']").hide();
//ClearNGridReferenceVariables();
}
Thanks,
Prava
I want to hide Radwindow from external javascript file, I tried various ways to hide Radwindow(without Radwindowmanager) but could not hide it completely. With " $find(delWindow).hide();" I was able to hide Radwindow but it did not hide the semitransparent overlay.
How can I call close()/hide() method on a Radwindow from external file?
$find(delWindow).hide();
$telerik.$("[id$='NGDeleteWindow']").hide(); .
//Hide Delete Window
function NGCloseDeleteWindow() {
var id = $telerik.$("[id$='DeleteWindow']").attr("id");
var delWindow = $find(id);
$find(delWindow).hide(); //$telerik.$("[id$='NGDeleteWindow']").hide();
//ClearNGridReferenceVariables();
}
Thanks,
Prava
5 Answers, 1 is accepted
0
Hi Prava,
There is a difference between the hide() and close() method of the RadWindow. If your RadWIndow is modal then hide() will keep the modal background, while close() will remove it. Most likely you need the close() method. The main problem is getting the ClientID in the external JavaScript file.
The easier approach is to use the RadWindowManager's client-side API - its getWindowByName() method only needs the server ID which you can know because you know which one you opened.
In all cases you need the proper reference to the control instance and not a jQuery object. You can use jQuery to get its ClientID and pass it to $find().
All this means that your function seems fine, just replacing hide() with close() should get the desired behavior.
Kind regards,
Marin Bratanov
the Telerik team
There is a difference between the hide() and close() method of the RadWindow. If your RadWIndow is modal then hide() will keep the modal background, while close() will remove it. Most likely you need the close() method. The main problem is getting the ClientID in the external JavaScript file.
The easier approach is to use the RadWindowManager's client-side API - its getWindowByName() method only needs the server ID which you can know because you know which one you opened.
In all cases you need the proper reference to the control instance and not a jQuery object. You can use jQuery to get its ClientID and pass it to $find().
All this means that your function seems fine, just replacing hide() with close() should get the desired behavior.
Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Prava kafle
Top achievements
Rank 1
answered on 02 Oct 2012, 07:39 PM
Hi Bartanov,
Using "RadwindowManager1.close()" solved my problem.
Thank you very much for your prompt response,
Prava
Using "RadwindowManager1.close()" solved my problem.
Thank you very much for your prompt response,
Prava
0
Waseem
Top achievements
Rank 1
answered on 14 Oct 2012, 02:26 AM
My Dear, in order to close Radwindow , you can use this in javascript.
1. Close Radwindow on button
2. Close Radwindow on LinkButton
3. Close Radwindow on ImageButton
<script language="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 closeWindow() {
GetRadWindow().Close();
GetRadWindow().BrowserWindow.location = parent.location;
}
</script>
<asp:Button ID="btn" runat="server" OnClientClick="closeWindow();" Text="Close RadWindow on Button" />
<asp:LinkButton ID="lnkButton" runat="server" OnClientClick="closeWindow();" Text="Close RadWindow on LinkButton"></asp:LinkButton>
<asp:ImageButton ID="imgButton" runat="server" OnClientClick="closeWindow();" ImageUrl="~/Images/close.png" />
Regards
Muhammad Waseem
1. Close Radwindow on button
2. Close Radwindow on LinkButton
3. Close Radwindow on ImageButton
<script language="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 closeWindow() {
GetRadWindow().Close();
GetRadWindow().BrowserWindow.location = parent.location;
}
</script>
<asp:Button ID="btn" runat="server" OnClientClick="closeWindow();" Text="Close RadWindow on Button" />
<asp:LinkButton ID="lnkButton" runat="server" OnClientClick="closeWindow();" Text="Close RadWindow on LinkButton"></asp:LinkButton>
<asp:ImageButton ID="imgButton" runat="server" OnClientClick="closeWindow();" ImageUrl="~/Images/close.png" />
Regards
Muhammad Waseem
0
Prava kafle
Top achievements
Rank 1
answered on 22 Apr 2013, 08:59 PM
Hi,
If I hide/close radwindwinow using external javascript file, I cannot open it again. Radwindow object is null. However, it works fine if javascript code is embedded in aspx page.
function1(){
//Getting rad window manager and hide radwindow
var oManager = GetRadWindowManager();
//Get an existing window DialogWindow using getWindowByName
var oWnd = oManager.getWindowByName("NGAddTktNotesWindow");
oWnd.close();
}
function2(){
//Getting rad window manager and show it.
var oManager = GetRadWindowManager();
//Get an existing window DialogWindow using getWindowByName
var oWnd2 = oManager.getWindowByName("NGAddTktNotesWindow");
oWnd2.show();
}
If function2 is called immediatley after calling function1, oWnd2 is null in external javascript file.
How can I close/hide/show radwindow from external javavscript file?
Thanks,
Prava
If I hide/close radwindwinow using external javascript file, I cannot open it again. Radwindow object is null. However, it works fine if javascript code is embedded in aspx page.
function1(){
//Getting rad window manager and hide radwindow
var oManager = GetRadWindowManager();
//Get an existing window DialogWindow using getWindowByName
var oWnd = oManager.getWindowByName("NGAddTktNotesWindow");
oWnd.close();
}
function2(){
//Getting rad window manager and show it.
var oManager = GetRadWindowManager();
//Get an existing window DialogWindow using getWindowByName
var oWnd2 = oManager.getWindowByName("NGAddTktNotesWindow");
oWnd2.show();
}
If function2 is called immediatley after calling function1, oWnd2 is null in external javascript file.
How can I close/hide/show radwindow from external javavscript file?
Thanks,
Prava
0
Hi Prava,
The most likely reason for this behavior is that you have the DestroyOnClose property of the RadWindowManager set to true. Because of that the RadWindow object is disposed when the popup is closed, so it should be expected that you cannot get a reference to it any more.
There are two ways to avoid this
- set DestroyOnClose=false if you do not use dynamic instances
OR
- directly use the open() method of the manager, the second parameter is the window name that you want opened:
http://www.telerik.com/help/aspnet-ajax/window-programming-radwindowmanager-methods.html
http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-common.html - on why it would not remember its settings even in this case - see the Once a RadWindow is closed, it “loses” all its settings (width, height, modality, etc.) section
Kind regards,
Marin Bratanov
the Telerik team
The most likely reason for this behavior is that you have the DestroyOnClose property of the RadWindowManager set to true. Because of that the RadWindow object is disposed when the popup is closed, so it should be expected that you cannot get a reference to it any more.
There are two ways to avoid this
- set DestroyOnClose=false if you do not use dynamic instances
OR
- directly use the open() method of the manager, the second parameter is the window name that you want opened:
http://www.telerik.com/help/aspnet-ajax/window-programming-radwindowmanager-methods.html
http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-common.html - on why it would not remember its settings even in this case - see the Once a RadWindow is closed, it “loses” all its settings (width, height, modality, etc.) section
Kind regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.