opening radwindow from radwindow as modal

20 posts, 1 answers
  1. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 11 Apr 2008 Link to this post


    I am opening a RadWindow from within RadWindow as per the examle.

    The second radWindow opens up fine, but it opens in the background of the first window. I have to click on the second window then it comes up on the top.

    I tried using setActive, setVisible, show - but none of them make the second window on top of first.

    Any idea?
    -Piyush
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 Apr 2008 Link to this post

    Hi Piyush,

    Can you please provide more details about your exact setup? How exactly you open these windows?



    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 14 Apr 2008 Link to this post


    I use these functions to open the Rad window. Strangely, at some places RadWindow within RadWindow opens up fine. But only for the following openReferral() method its not opening up correctly and opening behind another RadWindow.

    //used from ApptEdit.aspx for [Attach] button
    function openReferral(patId, apptId)
    {
        var url = 'AddEditReferral.aspx?PatientId=' + patId + '&AppointmentId=' + apptId;
        var owindow = OpenRadWindow(url, null, 650, 550);
        owindow.center();
        owindow.set_Title("Patient Referrals");
        owindow.setActive();
        owindow.set_Modal(true);
        return false;
    }


    //This code is used to provide a reference to the radwindow "wrapper"
    function GetRadWindow()
    {
       var oWindow = null;
       if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
       else if (window.frameElement && window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)
       return oWindow;
    }

    function OpenRadWindow(url, windowid, width, height)
    {
        var owindow = GetRadWindow();
        var rwindow = null;
        if (owindow == null)
        {
            rwindow = radopen(url, windowid);
        }
        else
        {
            rwindow = owindow.BrowserWindow.radopen(url, windowid);
        }
        if (rwindow != null)
        {
            rwindow.setSize(width, height);
        }
        return rwindow;
    }//OpenRadWindow
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 16 Apr 2008 Link to this post

    Hi Piyush,

    Unfortunately I am still unable to reproduce the problem locally. Please open a support ticket and send me a small sample project where this behavior can be observed - I will check it right away and get back to you with solution.



    Greetings,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Christian
    Christian avatar
    2 posts
    Member since:
    Apr 2008

    Posted 16 Apr 2008 Link to this post

    I am actually having the exact same problem.  I was trying to replicate the functionality from the "Communication between dialogs" and just can't get it to focus on the second window.  Below is the javascript I am using to open the dialogs (it is modeled off of the code):

    Parent Page (works perfectly):
    var oWnd = window.radopen(null, "ReplaceWindow");                    
    //Create a new Object to be used as an argument to the radWindow
    var arg = new Object();     
    arg.TargetElementID = targetElement.id;
    arg.BaseFileName = targetElement.attributes("FileName").value;
    arg.CustomerID = targetElement.attributes("CustomerID").value;
                    
    //Set the argument object to the radWindow  
    oWnd.Argument = arg;

    oWnd.setUrl(oWnd.get_NavigateUrl());

    Replace Window (first window) (this opens the second window but in the background and the first window is not "locked" as it is in the sample online):
    var currentWindow = GetRadWindow();
    var parentPage = currentWindow.BrowserWindow;
    var parentRadWindowManager = parentPage.GetRadWindowManager();
                       
    var generateWindow = parentRadWindowManager.open("Window_GenerateThumbnails.aspx","GenerateWindow");
          
    //Set the current argument object to the new radWindow  
    generateWindow.Argument = currentWindow.Argument;

    generateWindow.setUrl(generateWindow.get_NavigateUrl());

    ---------------------

    Any help would be greatly appreciated.
    Thanks,
    Christian

  7. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 17 Apr 2008 Link to this post


    I just observed a funny thing.

    By replacing <asp:button> which is opening the RadWindow, with an HTML input button - it opens the window on the foreground. If I use <asp:Button> then it opens up in the background of the caller window.

    Any clue?
    -Piyush
  8. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 21 Apr 2008 Link to this post

    Hi,

    Please, find the answers to your questions below:

    1. I was able to reproduce the difference you mention in the behavior of the standard asp button and the HTML input when opening RadWindow by clicking each of them. This behavior is related to browser specifics and not to the RadWindow control itself - you can get equal behavior in both cases if you set type="submit"  for the HTML input button.
    2. To set the focus to a RadWindow you need to call its setActive method with a boolean argument set to true. Furthermore, you should set a little timeout, actually a time interval equal to 0 will also do the trick. Below you can find a sample code snippet demonstrating how the focus should be set:

      function OpenSecondWindow()  
      {  
      var parentPage = GetRadWindow().BrowserWindow;  
      var secondWnd = parentPage.radopen('http://www.google.com','RadWindow2');  
      setTimeout(function(){secondWnd.setActive(true);}, 0);  
       

    Greetings,
    Svetlina
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Stuart McLeod
    Stuart McLeod avatar
    17 posts
    Member since:
    Jul 2005

    Posted 15 May 2008 Link to this post

    That all works fine, except with a modal dialog. It makes the top window modal but not any children. Any ideas? (I see this is probably a bug in the Q1 2008 release. I'll leave it with you.)
  10. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 17 May 2008 Link to this post

    Hi Stuart,

    The problem is due to browser specifics and the way the browser handles the button's click event. To avoid the problem, just set a timeout when opening the second window. Actually, a timeout of 0ms will do the trick.


    For your convenience I am attaching a sample demonstration project.


    Regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  11. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 23 Jul 2008 Link to this post

    This suggestion worked for me in the beta, but stopped working once I installed the Q1 release. I'm researching now.
  12. Rob Conley
    Rob Conley avatar
    47 posts
    Member since:
    Sep 2012

    Posted 23 Jul 2008 Link to this post

    Never mind... I had turned jscript debugging off and was not aware of a javascript error before the settimeout.
  13. Paolo Brunino
    Paolo  Brunino avatar
    24 posts
    Member since:
    Jul 2004

    Posted 29 Jul 2008 Link to this post

    I had the same problem.
    Setting the timeout got the opened radwindow on front but still it's not modal in respect to the radwindow that opened it.
    I'm opening with an html image button, opening with a html input button gives no problem, the window opens on front (without any timeout trick) and modal.
    Is there any way to get it modal with an image button calling it?

    thank you
  14. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 30 Jul 2008 Link to this post

    Hi Paolo,

    I tested opening two modal RadWindows with an image button on the main page and with image buttons on the main page and on the dialog. In both test projects the modality worked as expected as you can see from the attached projects.

    Please, examine them and in case you need further assistance, open a new support ticket and send me a reproduction project (or modify mine) along with a detailed explanation of the reproduction steps and some screenshots. Once I have a better understanding on your scenario I will do my best to help.


    Sincerely yours,
    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  15. Tye
    Tye avatar
    18 posts
    Member since:
    Feb 2008

    Posted 16 Feb 2009 Link to this post

    Hello. I was having the same problems but the solution you provided fixed the modal problems. However, I have an issue with the code you provided in sending arguments back from the second modal (Default3.aspx) to the first modal (Default2.aspx).

    I modified the files you sent and added a third page (Default3.aspx). The desired flow is:

    User clicks image in Default.aspx to launch first modal window, Default2.aspx.
    User clicks image in Default2.aspx to launch second modal window, Default3.aspx.
    User fills out text box in Default3.aspx and clicks "Save" button.
    Default3.aspx is dismissed and passes the text box value as an argument to Default2.aspx.
    Default2.aspx populates its own text box with the value passed in from Default3.aspx.

    However, since the RadWindow is actually declared in Default.aspx (which after much testing is apparently how you fixed the second modal window problem), and not Default2.aspx, OnClientClose is called from Default.aspx, and not Default2.aspx. Therefore Default2.aspx never gets the argument value...

    Is there a way to keep the fix for the two modal windows and be able to pass an argument from Default3 to Default2?

    Thanks,
    Tye
  16. Tye
    Tye avatar
    18 posts
    Member since:
    Feb 2008

    Posted 17 Feb 2009 Link to this post

    Nevermind, I found a way around it by using the get_contentFrame() method:

     

    var oWnd = GetRadWindowManager().getWindowByName("Properties");

     

    oWnd.get_contentFrame().contentWindow.CallbackFunction(arg);

    When the OnClientClose method of the root page is loaded, I simply pass the returned argument object back to the first dialog using the CallbackFunction method I defined.

    Thanks,

    Tye

  17. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 04 Aug 2009 Link to this post

    Thanks for the demo.  If you maximize the first rad window and then open the second rad window it does not open on top.  A working demo would be appreciated.  Thanks!
  18. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 04 Aug 2009 Link to this post

    Hello,

    I believe that this forum thread and the attached examples in it are exactly what you need.

    Kind regards,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  19. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 04 Aug 2009 Link to this post

    Nope.  That one doesn't work either.  Although it says it addresses the problem.  When the first rad window is maximized and you click on the button to open the second rad window you get this javascript error...

    Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'Object' cannot be converted to type 'Function'.
    Parameter name: handler

    In this function...

     

    function Sys$EventHandlerList$addHandler(id, handler) {

     

    /// <param name="id" type="String"></param>

     

    /// <param name="handler" type="Function"></param>

     

    var e = Function._validateParams(arguments, [

    {name:

    "id", type: String},

     

     

    {name:

    "handler", type: Function}

     

     

    ]);

     

     

     

    if (e) throw e;

     

    Array.add(

    this._getEvent(id, true), handler);

     

     

     

    }

     

     

  20. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 06 Aug 2009 Link to this post

    Hello,

    I reworked the project and reattached it to the current thread. Could you please check it and let me know whether it fits you requirement?


    All the best,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  21. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 06 Aug 2009 Link to this post

    I don't particularly care for the approach, but it works.  The user shouldn't have their first rad window resized for them.  IMHO.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017