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

Close Radwindow on Button

2 Answers 1011 Views
Window
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 18 May 2009, 06:35 AM
I want to close the radwindow on button click .... i have one from on that form show radwindow button after that button mouse over open rad window. In that rad window one Employee.aspx form on that form close button. when i click that button close the open radwindow+Employee.aspx form. How to close it ?
i am trying this code 

 

<input id="CloseButton" title="BAck to main Window" type="button" value="Close Form" onclick ="Closerad(); " /></td>

 

 

function Closerad()

 

{

 

 

 

var oManager = GetRadWindowManager();

 

 

 

var oWnd = oManager.GetWindowByName("RadWindow1");

 

 

 

 

 

//oWnd.Hide();

 

 

 

 

 

oWnd.Close();

document.getElementById(

 

"Button2").focus ();

 

 

}

but it showing script erro object Expected of employee.aspx form . how to resolve this problem urgent

Its urgent

Thank you so Much !!!!!!!!

 

2 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 18 May 2009, 09:19 AM

Hi rahul,

I already answered your other thread and for your convenience I pasetd my reply below. Please, note, that your other thread was for RadWindow for ASP.NET and this one is for RadWindow for ASP.NET AJAX and I am not sure what exact version you are actually using. In case you use the RadWindow for ASP.NET, you should use the method Close, with a capital "C", otherwise - with a small letter - close (this is important since javascript is case sensitive).

I am not sure whether you want to close the RadWindow from the main page or from within its content page. That is why I will describe the both scenarios for you.

Closing a RadWindow from the main page

In order to close the RadWindow from the main page, you should first obtain a reference to it (e,g with $find, depending on your setup) and then call its method close().

Closing a RdaWindow from its content page (e.g on button click)

The logic is the same but in order to get a reference to the RadWindow from inside it you should use the following GetRadWindow() function:

function GetRadWindow()  
{  
  var oWindow = null;  
  if (window.radWindow)  
     oWindow = window.radWindow;  
  else if (window.frameElement.radWindow)  
     oWindow = window.frameElement.radWindow;  
  return oWindow;  
}  

After you have declared this function, you should reference the RadWindow object and close it when needed as GetRadWindow().close().

You can find the GetRadWindow function in our online demos and documentation, e.g in the article below:

http://www.telerik.com/help/aspnet-ajax/window_programmingopeningfromwithin.html

and the close method is available in the control's client-side API reference:

http://www.telerik.com/help/aspnet-ajax/window_programmingradwindowmethods.html

I hope that my explanations are detailed enough and helpful, let me know how it goes.

Kind regards,

Svetlina
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 18 May 2009, 09:24 AM
Hello Rahul,

Try out the following client side code for closing the RadWindow on clicking the button which is placed in the RadWindow page.

JavaScript in Employee.aspx:
         
<script type="text/javascript"
function CloseWindow() 
    var oWindow = GetRadWindow();  //Obtaining a reference to the current window 
    oWindow.Close(); 
function GetRadWindow() 
   var oWindow = null
   if (window.radWindow) oWindow = window.radWindow; 
   else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
   return oWindow; 
</script> 

If you want to focus to a button which is placed in parent page after closing the window, then you can add the code for that in OnClientClose() event of RadWindow. Attach the OnClientClose() event and try the client side code as shown below.

JavaScript:
 
<script type="text/javascript"
function OnClientClose() 
    document.getElementById("Button2").focus(); 
</script> 

Thanks,
Shinu.
Tags
Window
Asked by
Rahul
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or