This is a migrated thread and some comments may be shown as answers.

Question about window.radopen positioning

3 Answers 243 Views
Window
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 29 May 2013, 07:57 PM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 30 May 2013, 11:57 AM
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:
http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-positioning-modal-popup.html
http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html

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


Regards,
Marin Bratanov
Telerik
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.
0
Boris
Top achievements
Rank 1
answered on 30 May 2013, 01:00 PM
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);
0
Accepted
Scott
Top achievements
Rank 2
answered on 20 Oct 2017, 10:58 PM

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));

SSirica
Top achievements
Rank 3
Iron
Iron
Iron
commented on 04 Apr 2022, 04:31 PM

Scott...This is exactly what I was looking for.  Worked like a charm.  Thank you so much!!!
Tags
Window
Asked by
Boris
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Boris
Top achievements
Rank 1
Scott
Top achievements
Rank 2
Share this question
or