Question about window.radopen positioning

4 posts, 2 answers
  1. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 29 May 2013 Link to this post

    I have a Dot Net 4.0 web app using Telerik controls version 2012.2.607.40.  (I know, we're going to upgrade soon.... I hope)

    I'm using a simple window.radopen call to open windows:   
    var oWnd = window.radopen("ScreenName.aspx?Id=" + Id, "Screen Title" );    

    Do I understand correctly?  

    This version of radopen is not capable of setting the opening position (left and top) of a window?  I've been trying to control position but so far no good.
  2. Answer
    Marin Bratanov
    Marin Bratanov avatar
    4533 posts

    Posted 30 May 2013 Link to this post

    Hello Boris,

    You are right, this version does not support the additional arguments in radopen() that set the size and position of the popup, nor the CenterIfModal property.

    You can, however, use the standard API of the control to achieve the same functionality:

    var wnd = window.radopen(url, nameWithoutSpaces);
    wnd.setSize(width, height);
    wnd.moveTo(left, top);

    Marin Bratanov
    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. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 30 May 2013 Link to this post

    Thanks!  Works perfectly.

    And a side note to others with the same problem.  

    If you want a window re-sized and centered based on the browser window, no matter what the size, try this:
       wnd.SetWidth($(window).width() * 0.9);                        
       wnd.SetHeight($(window).height() * 0.9);
       wnd.moveTo($(window).width() * 0.05, $(window).height() * 0.05);
  4. Answer
    Scott avatar
    17 posts
    Member since:
    Jul 2012

    Posted 20 Oct 2017 in reply to Boris Link to this post

    This only works if the window hasn't been scrolled.  To position it at the current scroll, it needs to look like this:

                    oWnd.SetWidth($(window).width() * 0.9);
                    oWnd.SetHeight($(window).height() * 0.9);
                    oWnd.moveTo($(window).width() * 0.05, document.documentElement.scrollTop + ($(window).height() * 0.05));

Back to Top