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

Window Close

3 Answers 107 Views
Window
This is a migrated thread and some comments may be shown as answers.
phil doc
Top achievements
Rank 1
phil doc asked on 23 Oct 2009, 09:57 AM
Hi,

Incredibly stupid question here but how do i get the window to close when I click a button within it instead of clicking the red x at the top right.

I was looking for a me.close() or something equivalent.

Thks,

Phil

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Oct 2009, 10:37 AM
Hi Phil,

Try the following client side code in order to close RadWindow when clicking button inside window page.

aspx:
 
<input id="Button2" type="button" value="button" onclick="closeWin()" /> 

JavaScript:
 
<script type="text/javascript"
function GetRadWindow() 
  var oWindow = null
  if (window.radWindow) 
     oWindow = window.radWindow; 
  else if (window.frameElement.radWindow) 
     oWindow = window.frameElement.radWindow; 
  return oWindow; 
}   
function closeWin() 
   var oWindow = GetRadWindow(); 
   oWindow.close(); 
}   
</script> 

-Shinu.
0
phil doc
Top achievements
Rank 1
answered on 23 Oct 2009, 10:41 AM
And how would i get that javascript method to fire after I've ran some server side code behind the button?

Thanks for the help,

Phil
0
Luis
Top achievements
Rank 1
answered on 28 Oct 2009, 02:46 PM
create the javascript as always on the source code then after you run your code behind do this:

ScriptManager.RegisterStartupScript(Me, Me.GetType, "Javascript", "javascript:closeWin();", True)


thanks
Tags
Window
Asked by
phil doc
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
phil doc
Top achievements
Rank 1
Luis
Top achievements
Rank 1
Share this question
or