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

Closing a radWindow not Working

3 Answers 146 Views
Window
This is a migrated thread and some comments may be shown as answers.
Chris Trina
Top achievements
Rank 1
Chris Trina asked on 04 Sep 2008, 01:15 AM
I have a page that opens and aspx page in a radWindow using the following code:

function

OpenWindow(id)
{
var wnd = window.radopen('../public/PotentialActivity_Details.aspx?PU=1&activityid='+id, 'Activity Details');
wnd.setSize(650,400);
wnd.moveTo(50,50);
wnd.set_modal(
true);
wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
wnd.set_status(
'');
return false;
}

On the aspx page, opened in the window there is a close button that performs the following client code:

function closePage()
{
var oWindow = GetRadWindow();
oWindow.argument =
null;
oWindow.close();
}

The problem is that instead of the window closing it is completely reloading itself!

Any suggestions would be GREATLY appreciated.

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 04 Sep 2008, 02:53 PM
Hi Chris Trina,

Is the closePage() function called from a postback control? If it does, the postback will reload the page - you need to cancel it in order to call the function in the OnClientClick property.
e.g.
<asp:Button ID="Button1" runat="server" OnClientClick="closePage(); return false" Text="click" />

I hope this helps. If this is not the problem, please open a support ticket and send me a project where I can reproduce it. I will get back to you with solution as soon as possible.


Greetings,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris Trina
Top achievements
Rank 1
answered on 04 Sep 2008, 03:29 PM
I just made a simple project and opened a support ticket.

Thanks
0
Georgi Tunev
Telerik team
answered on 05 Sep 2008, 06:39 AM
Hi Chris,

Thank you for the project - I can see what the problem is. In your closing function, you are getting a reference to the RadWindow by using var oWindow = GetRadWindow(), but the GetRadWindow() function itself is not present on that page.

Just add the GetRadWindow() function in your code and the window will be closed as expected:

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




Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Chris Trina
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Chris Trina
Top achievements
Rank 1
Share this question
or