Will using RadWindowManager.Open function instead of RadOpen cause any issues?

14 posts, 0 answers
  1. Amar
    Amar avatar
    21 posts
    Member since:
    Oct 2008

    Posted 06 Feb 2009 Link to this post

    Hi,

    I have been using RadOpen function to open the first dialog and if any further dialogs from within the newly opened dialog are required, i have been using parentwindowmanager.open function.

    I just noticed that i dont really need to call RadOpen function to open the first dialog, the first dialog and all the dialogs can just be opened using the

    radwindowmanager.open function.

    I have now decided to use the .open function throughout, I would like to know if this is an suitable way of doing things and does it have any issues associated with this. Should one be using RadOpen always to open the first dialog?

    I am doing this because, although i could open the first dialog with radopen and consume the add_close function. Everytime i tried to do this with open function, it threw up a stack overflow probelm.
    So now i have found this work around to the above problem and would like to make my code more consistent and only use just one function.

    http://www.telerik.com/community/forums/aspnet-ajax/window/onclientclose-clientcallbackfunction-not-firing-after-window-close-arg-is-called.aspx




  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 09 Feb 2009 Link to this post

    Hi Amar,

    GetRadWindowManager().open() does the same thing as radopen, so there should be no problems replacing it. As for the stack overflow problem that you have experienced, could you please provide more details on what exactly is your setup? How do you open the windows and how do you attach the OnClientClose handler?


    All the best,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Amar
    Amar avatar
    21 posts
    Member since:
    Oct 2008

    Posted 09 Feb 2009 Link to this post

    Hi Basically

    if i open a window using GetParentWindowManager.open method and in the method i try to subscribe to the

    oWnd.add_Close(function)

    function, the stack overflow error would occur always.  The following demonstrates the code.

    //Set the OnClientClose dynamically by using the ASP.NET AJAX convention.   
    //Useful for RadWindows created on the client.   
    function OpenWin()      
    {   
       var oWnd = GetParentWindowManager().open("Dialog.aspx"null);          
       oWnd.add_Close(OnClientCloseWin);      
    }      
      
    function OnClientCloseWin()   
    {              
       //Your code here              
       alert('Closed');   
    }   
      

  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 09 Feb 2009 Link to this post

    Hello Amar,

    Yes, I suspected that - you are setting the OnClientClose from within the content page. The stack overflow error that arises from this is indeed due to a problem in the MS AJAX framework and we cannot fix it on our side.

    The good news however is that we managed to find a workaround. The idea is to ensure that the function added to some object with add_close is in the context of the page where the object is.
    e.g. in the case with RadWindow:

    var oWnd = GetRadWindow(); 
    var browserWin = oWnd.BrowserWindow; 
    var fn = new browserWin.Function("sender","args""alert(sender + ' was closed');"); 
    oWnd.add_close(fn); 

    I hope this helps. .

    Greetings,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Amar
    Amar avatar
    21 posts
    Member since:
    Oct 2008

    Posted 09 Feb 2009 Link to this post

    Hi Thanks for the reply,

    I queried this forum for the stack overflow error and managed to find only two or three topics discussing it. One of which did mention that it was a microsoft ajax problem. Therefore i am now using the method below.

        var oWnd = parentRadWindowManager.open(url, "editScreen");
        oWnd.argument = OnClientClose;

    In the child dialog

    function CloseEditWindow() {
        //get a reference to the RadWindow
        var oWnd = GetRadWindow();
        if (oWnd != null) {

            if (oWnd.argument != null && oWnd.argument != undefined) {
                oWnd.argument();
            }
            oWnd.close();
        }
    }

    Obviously the above is only useful if you are calling the CloseEditWindow manually, as i do not use the RadWindow's close button but instead provide my own close button and call the  CloseEditwindow method which lets the parent know that the window is being closed.

    Thanks.

    Amar




  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 09 Feb 2009 Link to this post

    Hello Amar,

    I am not quite sure if I understand your scenario correctly. Could you please open a support ticket and send me a small sample project where I can reproduce the problem?


    Kind regards,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Lyle Groome
    Lyle Groome avatar
    22 posts
    Member since:
    Dec 2005

    Posted 20 Mar 2009 Link to this post

    This is upsetting...

    If the oWnd.add_close(myfunction) has the bug that requires that the function reside "in the context of the page where the object is" otherwise getting a a stack overflow.  Then why did you obsolete the oWnd.set_clientCallBackFunction which did not have this limitation.

    My pages have an iframe page on them and instead of opening up the radwindow in the limited space of the iframe I open the window on the top page and assign it a client callback function that resides in the IFrame. 

     

    var oWndTop = top.radopen("myurl", "IFrameFindersDialogWindow");   
    oWndTop.set_clientCallBackFunction(IFramePageOnClientCloseFunction);  
     
     

    I never had a problem up until I was forced to change to the add_close method because you obsoleted the method I use all over my app. 

    Is this a good enough reason to bring back the obsolete method? 
    (Not to mention that I can stop the weeks worth of re-work I have to finish before I can finish upgrading to Q1 2009). =(

    Here's what I've done so far to get my scenario to work. I'm not sure how many of my situations it will work on. But I'm hoping you'll share a better way... In the Iframe page's function:

    function ShowStudentFilterDialog() {  
        var oWndTop = top.radopen(null, "IFrameFindersDialogWindow");  
        oWndTop.SetUrl("./FinderPopup.aspx");  
          
        var browserWin = oWndTop.BrowserWindow;  
        var fn = new browserWin.Function("sender", "args",   
            "document.getElementById('" + window.frameElement.id + "').contentWindow.StudentFilterOnClientClose(sender, args);");  
        oWndTop.add_close(fn);  
        //oWndTop.add_close(StudentFilterOnClientClose);    
  9. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 23 Mar 2009 Link to this post

    Hello Lyle,

    You would experience the same problem with the client callback function - the limitation comes from the framework, not the control itself.

    As for the problem that you experience, please open a support ticket and send us a sample project that uses your logic and shows the problem. This will allow us to get a better view over your exact setup and to provide you with the most appropriate suggestion.



    Greetings,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  10. Bent
    Bent avatar
    38 posts
    Member since:
    Sep 2008

    Posted 18 Dec 2009 Link to this post

    I just ran into this problem after upgrading to the latest version of RadControls.
    Before everything was working correctly, but now it's broken.

    Are you saying that this is a bug introduced by Microsoft when I upgraded RadControls? I don't get it.
  11. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 19 Dec 2009 Link to this post

    Hello Kenneth,

    Would you please clarify what is the exact problem you are experiencing? The problem my colleague is explaining about the stack overflow has always been present in such configuration and thus if your demo was working as expected before, this is not the same problem.

    All the information you have provided is that "Before everything was working correctly, but now it's broken." - this is not enough to understand what is the exact problem and even the result or error you receive.

    This being said, please provide more detailed explanations of errors you get, their message text, screenshots and some relevant reproduction code based on which we can observe and debug the setup locally. Once we receive this information, we will do our best to help.

    Regards,
    Svetlina
    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.
  12. Bent
    Bent avatar
    38 posts
    Member since:
    Sep 2008

    Posted 21 Dec 2009 Link to this post

    Hello Svetlana

    I am sorry for my very brief, or non-existent, error description. I was just annoyed and a bit desperate for a solution, which seemed to be to point fingers at Microsoft.

    The fact is that I in previous versions have had no problems at all opening and attaching the add_closed event handler for windows opening from other windows using the same RadWindowManager. This is suddenly broken.

    As I can't show you all the code, I'll try to summarize it here.

    I have a primary, default, page, which hosts a RadWindowManager with two windows - a login window and a forgot password window.
    When i press one of four different links on the default page, the login dialog window appears. When the window is opened I attach the add_closed event to a function, which basically removes the add_closed event on the sender like so:

    function open() {  
        var mgr = [get radwindowmanager];  
        var wnd = window. mgr.getWindowByName("loginDialog");  
        wnd.add_closed(closed);  
    }  
     
    function closed(sender, e) {  
        sender.remove_closed(closed);  

    So far everything works as expected. Of course the closed function does some more logic, but that is besides the point.
    Now, within the login dialog window, I have a link for displaying a "Forgot password" dialog. The logic for handling this is pretty much the same as the above with the exception that I call parent.GetRadWindowManager().
    At the point when I reach wnd.add_closed(...) I get a Stack Overflow error.
    The scripts are each placed in their own scriptmanagers on each page (I guess this has something to do with the problem).

    The funny thing is that it has worked as expected before, but now it's broken. I have absolutely no idea how I could have been able to introduce this bug myself, as the only thing I have done is replaced the old version the the controls with the latest.

    As this doesn't seem to affect any other place where I have done similar things, I believe it's a rare situation, and are willing to try any ideas you might have.

    For the time being I have solved my problem by simply redirecting the login dialog to the forgot password page, instead of opening a nye window. This is actually a better solution, but it hasn't really solved anything, it was just a workaround.


    Sincerely
    Kenneth
  13. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 21 Dec 2009 Link to this post

    Hello Kenneth,

    I cannot say what is the exact reason for this error in your case without having a closer look at your exact setup, so at this point I am unable to tell why the upgrade lead to such problem. Basically, this error occurs if you have enabled the debugging in your web.config file - when debug is set to true, the ASP.NET AJAX framework outputs a lot of JavaScript debugging code on the client which in some scenarios (like the one discussed in this thread) leads to "Stack Overflow". To avoid that, you should either switch the debugging off, or as an alternative - to add the close handler on the parent page, where the RadWindowManager is.
    For example, you could put a JavaScript function on your main page and then to call it from within the content page - top.calledFn().


    Kind 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.
  14. Andrea Gugiatti
    Andrea Gugiatti avatar
    5 posts
    Member since:
    May 2006

    Posted 24 Sep 2010 Link to this post

    this is an MS AJAX bug. my workaround for this problem is to set the property ScriptMode = "Release" in scriptmanager. I hope this help.
  15. RBarnes
    RBarnes avatar
    46 posts
    Member since:
    Oct 2012

    Posted 12 Feb 2013 Link to this post


    Setting ScriptMode = "Release" in scriptmanager seemed to work for me as well. I had it set to Debug and experienced this issue.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017