Radwindow loaded from code behind, closing with javascript..GetRadWindow returns incorrect id on first attempt

3 posts, 0 answers
  1. Neal
    Neal avatar
    114 posts
    Member since:
    Apr 2008

    Posted 07 Mar 2012 Link to this post

    Hi all,

    Been some years since I've been on these forums..anyway.
    version = 2009.2

    I open my Radwindow (login) from codebeind. (No default behaviours...just login button which if clicked and login is valid ,  must close the radwindow)
    On users click of "login"  button"..I do the usual to close the popup(radwindow login)

     

    function GetRadWindow() { 
        var oWindow = null
        if (window.radWindow) oWindow = window.radWindow; 
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
        return oWindow; 
        
      
    function Close() { 
        var oWindow = GetRadWindow(); 
        alert (oWindow);
        oWindow.argument = null
        oWindow.close(); 
        

    but


    On first "login " click" ...nothing,..does not close...the Close function gets the oWindow var from GetRadWindow,..
    and the alert shows it as id ctl003
    On 2nd "login " click  ..the alert shows id ctl002
    and it closes.

    Tried a few javascripts , loading it from javascript as oppposed to from code behind, ..but no joy.
    There must be a way I'm sure, but ..how?
    TIA
    Neal
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4529 posts

    Posted 09 Mar 2012 Link to this post

    Hello Neal,

    Are you using the ContentTemplate? If so then getting a reference to the RadWindow is done via the $find() method, not via the GetRadWindow() function. This is explained in this online demo. If this is not the case please take a look at this thread as it treats a similar question. In it there are two suggested workarounds, but I cannot confirm if they have been effective since we never got feedback from the client. I also strongly advise that you upgrade to the latest version as soon as you can, because there have been many improvements, new features and new controls in the last couple of years and you can benefit from them. I realize such a large version jump is going to be rather difficult, but only the later versions can support modern browsers, as each browser version introduces its own quirks and problems, of which older controls versions cannot be aware and take into account.


    Greetings,
    Marin
    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. Neal
    Neal avatar
    114 posts
    Member since:
    Apr 2008

    Posted 13 Mar 2012 Link to this post

    Hi Marin,
    Thanks,
    I'm not using the content template,..but the one workaround seems to do the trick.
    What was suggested on the thread was the change in the "else if"  of the GetRadWindow function.
    An alert here returns Radwindow id="Login" ..which is the Id of the RadWindow in the RadWindowManager...so we're good.
    i.e.
    function GetRadWindow()
    {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement && window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }

    Re: newer Telerik versions,..agreed, though thus far IE7,8, latest MozFF all behaving perfectly still with 2009.2
Back to Top