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

Close RadWindow Programmatically

1 Answer 487 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 26 Oct 2011, 08:47 PM
I am working with the RadWindow, and an objective is to close the RadWindow once a navigateUrl is applied to a HyperLink;
 
The issue is with the close of the RadWindow, and how best to close the RadWindow programmatically with C# and/or JavaScript;

Thank in advance for any insight;  Best regards - Rob 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Oct 2011, 06:18 AM
Hello Robert,

You can try the following approaches to close the RadWindow.

i) Try the following code to close the RadWindow by javascript.
JS:
<script type="text/javascript">
function OnClientClick()
{
  var win = $find('<%=RadWindow1.ClientID %>');
  win.Close();
}
</script>

ii) Try the following code to close the RadWindow from code behind. You need to inject the javascript function to the asp label as it's text and write the client side code to close the RadWindow.

ii) C#:
protected void btn_Click(object sender, EventArgs e)   
{   
  Label1.Text = "<script type='text/javascript'>Close()</" + "script>";   
}

JS:
<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 Close()     
{     
  GetRadWindow().Close();          
}         
</script>

Thanks,
Princy.
Tags
Window
Asked by
Robert
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or