Refreshing Parent RadWindow from RadWindow

4 posts, 1 answers
  1. Kyle
    Kyle avatar
    5 posts
    Member since:
    Feb 2012

    Posted 19 Feb 2013 Link to this post

    I've seen many posts that are similar to my issue but none of the suggestions work in my specific case.  I've already seen topics such as this one ( and this one (, however both of those solutions seem to be for when you are refreshing the entire page, not a Parent RadWindow from a Child RadWindow.

    I have a master page that opens a RadWindow with a RadGrid.  This RadWindow is dynamically added so I do not know the sepecific ID because there might be other RadWindows that are open from the master page.  There is also a button on that page that executes code behind, then based on certain criteria, it opens another RadWindow through a RegisterStartupScript that calls the following JavaScript:

    function GetRadWindow() {
                        var oWindow = null;
                        if (window.radWindow)
                            oWindow = window.radWindow;
                        else if (window.frameElement.radWindow)
                            oWindow = window.frameElement.radWindow;
                        return oWindow;
    function OpenModalRadWin(args) {
                        if (args == null)
                            alert("There was no URL supplied by the code.  Please contact the system administrator.");
                        else {
                            var RadWinManager = GetRadWindow().get_windowManager();
                            var newWin =;
                            newWin.setSize(250, 250);
                            setTimeout(function() { newWin.setActive(true); }, 0);
                        return false;

    The original window was opened in a similar JavaScript function except it is not modal.

    The modal window takes user input and stores that in a database, then closes itself using GetRadWindow().Close(); in JavaScript.  I've tried to get the parent page (the first RadWindow) to either refresh or rebind the grid but all of the samples and other posts seem to not have a RadWindow within a RadWindow.  The JavaScript in the Parent RadWindow is not getting called by the Child RadWindow.  Below is some of the code commented out of what I've tried (it uses the same GetRadWindow() function as above:
    function CloseWin() {
                //__doPostBack("<%=btnCancel.UniqueID %>", "");
                return true;

    I know that it isn't even calling the function on the Parent RadWindow because all I have it doing right now is calling alert('test'); and the alert is not coming up and the Child is not closing.

    How do I call a function on a Parent RadWindow from a Child RadWindow?  More importantly, how do I only refresh the Parent RadWindow from a Child RadWindow without refreshing the entire page (master page).
  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    3907 posts

    Posted 20 Feb 2013 Link to this post

    Hello Kyle,

    I am not sure I completely understand the structure you have. My take is the following:
    Master page + content page
         RadWindow1 + child page 1 that hosts RadWindow2
              RadWIndow2 + child page 2 that must refresh child page1

    If this is the case calling the following from child page 2 will get you a reference to the window object of child page1:
    GetRadWindow().BrowserWindow, or simply window.parent
    You can further get a reference to RadWindow1 by
    GetRadWindow().BrowserWindow.GetRadWindow() (assuming the the GetRadWindow() function is present in child page 1, of course).

    If you have horizontal hierarchy, i.e. RadWindow2 is not nested within RadWIndow1 and they are both dynamic, you could use a custom field in the second popup's object to store a reference to the first (where I assume you are already familiar with the approach).

    You can find attached a simple example of both scenarios. I hope it is helpful.

    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Kyle
    Kyle avatar
    5 posts
    Member since:
    Feb 2012

    Posted 20 Feb 2013 Link to this post

    Both windows are dynamically opened from the same RadWinManager.  There may also be several other windows open at the same time, but I'll use your terminology of MasterPage, RadWindow1, and RadWindow2.  I think the problem is that RadWindow2 can't find RadWindow1.
    RadWindow1 is opened from the MasterPage using the following:
    var WinManager = GetRadWindowManager();;
    where eventArgs.get_item().get_value() is a URL that is passed to the javascript function.

    What was posted in the original post was how RadWindow2 is opened from RadWindow1.  Since all windows are opened dynamically, I cannot use the following from the page you and I both referenced because I do not have a Window name (it is dynamic).
    var oWnd = GetRadWindowManager().getWindowByName("RadWindow1");

    I've tried using GetRadWindow().BrowserWindow.RefreshGrid();   from RadWindow2, but it isn't even getting called.  In fact, if I put that code before my GetRadWindow().Close();  and the .Close() doesn't even get called, so it isn't communicating with RadWindow1.  As of now on RadWindow1, all that I have is alert('test'); in the RefreshGrid() function so I know that the two RadWindows are communicating together (which they are not).
    Could I add RadWindow1's reference to the args in the OpenModalRadWin() function.  The args variable is just a URL that is passed in that typically is something like anotherwebpage.aspx?p=123&PassedVar=1, so possibly add the value of GetRadWindow() to the variables being passed to the web page and use them on that end.  If so, how would I use it in RadWindow2 since I can't use getWindowByName() because RadWindow1 doesn't have a hardcoded name.
  4. Kyle
    Kyle avatar
    5 posts
    Member since:
    Feb 2012

    Posted 20 Feb 2013 Link to this post

    Your sample worked! Thanks!  I was able to use newWin.firstDialogReference = GetRadWindow(); in RadWindow1 right after the setTimeout for the open function and then could use the GetRadWindow().firstDialogReference.get_contentFrame().contentWindow.RefreshGrid(); line in my CloseWin function on RadWindow2.
Back to Top