RadWindows and UserControls

2 posts, 0 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 10 Feb 2011 Link to this post

    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
  2. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 10 Feb 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top