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

RadWindows and UserControls

1 Answer 49 Views
Window
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 10 Feb 2011, 11:33 AM
I have a 'common dialog' that I use in lots of places in my app.

Rather than define it lots of times I put it in a control and access it that way. Works a treat.

Now I need to call that common dialog from another RadWindow (we'll call it PopupPage). And I need PopupPage to execute it's own copy of a JS function when the common dialog closes.

Now, I've worked out how to do all of that.

But, the PopupPage and the common dialog have to be managed by the same RadWindowManager for it to work.

Why? Because I'm using the techniques in this documentation article to call a function in one RadWindow (common dialog) from another RadWindow (PopupPage). The problem is that my common dialog needs to find the PopupPage to execute a script on it and it does it using this code ...
var popupPage = oWnd.get_windowManager().getWindowByName(callerName);      
popuPage.get_contentFrame().contentWindow.ProcessClose(args);

Now my code actually passes the name of the calling window (PopupPage) to the commondialog (as callerName) when it opens it. So knowing the window isn't a problem. The problem is that I want my commondialog to exist in a .ascx page which means that it either is managed by a different RadWindowManager or with no manager at all.

Either way, calling .get_windoiwManager().getWindowByName() isn't going to get me the results I'm looking for.

So, how do I call a a function on a page in one RadWindow from a page in another RadWindow when the 2 RadWindows are managed using different RadWindowManagers?

-- 
Frustrated of Grantham

1 Answer, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 10 Feb 2011, 01:20 PM
SmartyPants of Grantham writes...

Ha! I think I've solved it.

My commondialog control now exposes a public property, Register(RadWindowManager WindowManager). This property is called by the main page in its OnInit event handler and is passed the RadWindowManager from that page (the one that manages my PopupPage). The Register method looks like this ...

public void Register(RadWindowManager WindowManager) {
    WindowManager.Windows.Add(winCommon);
}

Now, when the main page runs, it registers the common dialog with the window manager which means that my common dialog knows where to find the window that opened it an it all works!

-- 
Happy of Grantham
Tags
Window
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Share this question
or