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

Whats the best way to close an open window

5 Answers 81 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 30 Jun 2009, 12:50 PM
Hi
im using the radwindows manager to create new windows for different senarios but i would like to know what is the best way to close these windows programmatically

Many thanks in advance

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Jun 2009, 01:43 PM
Hello Kevin,

Try the following code snippet in order to close the RadWindow from code behind of dialog page.

CS:
 
protected void Button1_Click(object sender, EventArgs e)    
     string script = "<script language='javascript'type='text/javascript'>Sys.Application.add_load(CloseWindow);</script>";   
     ClientScript.RegisterStartupScript(this.GetType(), "Close", script);    

JavaScript:
 
<script type="text/javascript">        
function CloseWindow(sender, args)        
{            
    GetRadWindow().close();       //closes the window        
}        
function GetRadWindow()   //Get reference to window     
{        
    var oWindow = null;        
    if (window.radWindow)        
         oWindow = window.radWindow;        
    else if (window.frameElement.radWindow)        
         oWindow = window.frameElement.radWindow;        
    return oWindow;        
}        
</script>     

Thanks,
Shinu
0
Kevin
Top achievements
Rank 1
answered on 30 Jun 2009, 02:08 PM
Hi Shinu
i have put that into my code but im now getting an object not defined error when i try to run it
thanks
Kevin
0
Phil
Top achievements
Rank 2
answered on 30 Jun 2009, 07:14 PM
Hi:
The above is placed in the windowed form.  Not the parent.  I use a variant of the above, using ScriptManager instead of ClientScript ... thusly, I do not need the <script> tags:
Protected Sub CloseForm() 
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Close", "GetRadWindow().Close();", True) 
End Sub 
 

0
Fiko
Telerik team
answered on 02 Jul 2009, 10:40 AM
Hi Kevin,

I believe that the following links will be of help as well:

Greetings,
Fiko
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
Martin
Telerik team
answered on 02 Jul 2009, 10:40 AM
Hi Kevin,

I believe that the following links will be of help:


Greetings,
Martin Ivanov
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.
Tags
Window
Asked by
Kevin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Kevin
Top achievements
Rank 1
Phil
Top achievements
Rank 2
Fiko
Telerik team
Martin
Telerik team
Share this question
or