This is a migrated thread and some comments may be shown as answers.

any ideas please

2 Answers 26 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 29 Jul 2009, 12:58 PM
Hi i have an open window that opens a second window on a button being pressed what i want to do is close the first window while the second is being opened is there a way to do this?

the second window is opened programmatically from the first

Many thanks
Kevin

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 29 Jul 2009, 01:41 PM
Hi Kevin,

If the second RadWindow is opened in the first one, this is not possible - RadWindow exists only in the context of the page from which it is called.
If the second RadWindow is opened on the parent page as well (like in this demo), you only need to call first window's close() method after you have opened the second RadWindow.
e.g. (using the code from the demo)
function openWin2() 
    var parentPage = GetRadWindow().BrowserWindow; 
    var parentRadWindowManager = parentPage.GetRadWindowManager(); 
    var oWnd2 = parentRadWindowManager.open("Dialog2.aspx","RadWindow2"); 
    //new 
    GetRadWindow().close(); 


All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Shinu
Top achievements
Rank 2
answered on 29 Jul 2009, 01:56 PM
Hi,

I guess you are following the documentation " Opening a RadWindow from Within a RadWindow " in order to open the new radwindow. I tried following client code for closing the first window on opening the second window. Here I attached OnClientLoad() event to second RadWindow in order to close the first one. Give a try with following code.

ASPX in parent page:
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
<Windows> 
    <telerik:RadWindow runat="server" ID="RadWindow1" ></telerik:RadWindow> 
    <telerik:RadWindow runat="server" ID="RadWindow2"  OnClientShow="OnClientShow"></telerik:RadWindow> 
</Windows> 
</telerik:RadWindowManager> 

JavaScript:
 
<script type="text/javascript"
function openWin() 
    var oWnd = $find("<%=RadWindow1.ClientID%>"); 
    oWnd.setUrl('Window1.aspx'); 
    oWnd.show();   
function OnClientShow() 
    var oWnd = $find("<%=RadWindow1.ClientID%>"); 
    oWnd.close(); 
</script> 

Shinu.
Tags
Window
Asked by
Kevin
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or