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

Problem returning values from radwindow

6 Answers 143 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ainhoa Larumbe
Top achievements
Rank 1
Ainhoa Larumbe asked on 18 Nov 2009, 10:52 AM
Hello,

I have a radwindow manager in a control added to the master page. After that I place another radwindow in the page I am working on (a page that uses the master page): Default.aspx.
In this new rad window manager (RadWindowManagerSearch) I have 3 rad windows: one that I open from this page and the other two that will open as popups from the first popup window.
Basically, I want to open a search window and from that one be able to open different windows. From these last windows I want to return data to the first window. When clicking a button in the first button I want to return data to the initial page (Default.aspx).

To open the first popup window (RadWindowSearch) from Default.aspx page I used:

var managerC = $find("<%= RadWindowManagerSearch.ClientID %>");  
managerC.open("search.aspx", "RadWindowSearch"); 

Then I opened a second popup window from the first one and when returning the values, tried to find the first popup window with:

GetRadWindow().get_windowManager().getWindowByName("RadWindowSearch"); 

It didn't work (returns null) beacuse it was finding as radwindow manager the first one rendered in the page (the one in the control in the master page) instead of the radwindow manager in Default.aspx

To solve this I removed the radwindowmanager (and kept the radwindows) from Default.aspx and now open the first popup with:

 

var oWnd = radopen("search.aspx", "RadWindowSearch"); 

 

 

 

 

And to open other popups from RadWindowSearch:
var parentPage = GetRadWindow().BrowserWindow;  
 
var parentRadWindowManager = parentPage.GetRadWindowManager();  
 
var oWnd2 = parentRadWindowManager.open("clients_filter.aspx", "RadWindowSearchClients");  
 
window.setTimeout(function() {  
 
oWnd2.setActive(true);  
 
}, 0);  
 

 

Now I can return data from second popups to first popup (RadWindowSearch) by using the previous line:
 

 

GetRadWindow().get_windowManager().getWindowByName("RadWindowSearch"); 

However, now I can't return data from the first popup (RadWindowSearch) to Default.aspx because it doesn't execute the OnClientClose function. This function was fired when using a radwindomanager in Default.aspx.

How can I now return data from the first popup to the page?
Or, how can I keep the radwindowmanager in Default.aspx and make the second popups find the first one (RadWindowSearch)? Is there a way to do get_windowManager() but by name?

Thank you,


6 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 18 Nov 2009, 01:00 PM
Hi Ainhoa,

If you are indeed using Q3 2009, we've made some improvements in RadWindowManager's logic regarding such scenarios. Now it is possible to get a reference to a specific RadWindowManager and to call its methods.
For example:
var manager = $find("<%= RadWindowManager1.ClientID %>");
manager.open("http://google.com", "RadWindow1");
manager.radalert("alert text");

etc.

I hope this helps. If you still experience problems with your setup, please open a support ticket and send us a small sample project where the problem could be reproduced. We will check it and do our best to help.



Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ainhoa Larumbe
Top achievements
Rank 1
answered on 18 Nov 2009, 01:16 PM
Hi Georgi,

Thank you for the solution, but I am currently using Q1, is there any way to do this without upgrading to Q3?
Or is there any way to fire the OnClientClose function with the scenario I have and Q1?

Thanks again,

Ainhoa
0
Accepted
Georgi Tunev
Telerik team
answered on 18 Nov 2009, 02:24 PM
Hi Ainhoa,

In such case you could consider reworking your logic to use standalone RadWindows. You can get a reference to them, open them and assign the OnClientClose eventhandler by using the client-side API.
e.g.
var oWnd= $find("<%= RadWindow1.ClientID %>");
oWnd.add_close(OnClientClose);

oWnd.show();

function OnClientClose(sender, args)
{
   //your code here
   //remove the handler to avoid calling the function multiple times when you open the window again
   sender.remove_close(OnClientClose);
}



Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ainhoa Larumbe
Top achievements
Rank 1
answered on 19 Nov 2009, 10:45 AM
Hi Georgi,

That worked like a charm.
I was trying to use the method OnClientClose to add the close function but wasn't working, and the way you mention works perfectly. I couldn't fidn the add_close in the Client side functions documentation...

Thanks again for all your help,

Ainhoa
0
Georgi Tunev
Telerik team
answered on 19 Nov 2009, 11:01 AM
Hi Ainhoa,

It is good to know that everything is working fine now. As for the method, it is documented in Controls / RadWindow / Client-Side / RadWindow Methods (online version).


Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ainhoa Larumbe
Top achievements
Rank 1
answered on 19 Nov 2009, 11:46 AM
Oh, I see. I was ovbiously looking at the wrong documentation.
Thanks!
Tags
Window
Asked by
Ainhoa Larumbe
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Ainhoa Larumbe
Top achievements
Rank 1
Share this question
or