I have a RadWindow which is popped up and centered. When the user decides to resize the browser window (e.g. changing it from maximized to partial-screen) the RadWindow does not re-center. I thought the easiest way to do this would be a bit of jQuery, but it doesn't seem to be firing?
10 Answers, 1 is accepted
You can easily handle this by calling the Center() method from OnClientResizeEnd in a specified timeOut.
Hope it helps.
It is not the RadWindow that is being resized. It is the browser window. The RadWindow is modal and should always be displayed/visible, but when the browser window is resized it falls below and the user has to scroll the browser window down to see it / close it. I would expect something like the property KeepInScreenBounds to do this for me, but I guess not.
Your code seems to be logically correct but here are some assumptions I prepared for you which might be the issue in your case:
1) Make sure that you handle the resize of the main page window object - if your code is inside a RadWindow's content page (I assume that this is possible because of the GetRadWindow function), attach it to the main page by using e.g BrowserWindow property or simply move the code to the main page and use $find to reference the RadWindow client object.
2) In case you use this code on the main page, make sure that it is not called too early in the page client lifecycle. To ensure that the RadWindow object is created, you should attach the handler at pageLoad at earliest.
At last, I prepared for you a small example based on your code:
I hope that my reply is helpful, let me know how it goes.
the Telerik team
I am not trying to get the RadWindow centered on page load. I am already accomplishing that by calling oWindow.center(); after oWindow = window.radopen(..,..);
I am trying to get the RadWindow to recenter when the size of the browser window changes. pageLoad does not re-fire when the browser window resizes. I am unable to find a way to hook up to the browser window's resize event handler to re-center the rad window open on the browser window.
Have you tried the code Svetlina posted? On my end it seems to be working fine and does exactly what you want to achieve.
It uses the pageLoad() function to only attach the event handler to the browser window, so that it is sure that the AJAX enabled controls are already loaded on the page before trying to use them.
All the best,
the Telerik team
I know this post is a bit old, but I'm having a problem with centering a radwindow inside another radwindow. I've tried using .center() on the clientside and an number of other methods but nothing seems to work as of now.
Ideally what I'm trying to accomplish is having the inner (second) radwindow (it goes browser window -> first radwindow -> second radwindow) be centered to the current scroll position of the first radwindow, rather than centered to the entire height of the first radwindow. For example, if the total height of the first radwindow was 1000 and the user scrolled halfway down (so the top of their screen starts at 500), I'd want the inner radwindow to be centered in the lower 500 region rather than centered to the total 1000.
Here's how my radwindow looks on the serverside
RadWindow PopUpForm = new RadWindow
ID = "PopUpForm",
Title = "title",
ShowContentDuringLoad = false,
Top = 200,
Left = 275,
Width = 450,
Height = 200,
AutoSize = true,
Modal = true,
CenterIfModal = false,
OnClientClose = "OnWindowClose",
KeepInScreenBounds = true,
Behaviors = WindowBehaviors.Maximize | WindowBehaviors.Move | WindowBehaviors.Resize | WindowBehaviors.Reload
and I need to call it on the server side, so I'm doing this:
string script =
RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "mykey", script, true);
You can handle the OnClientResizeEnd event of the first window, where you can find the second window and call its center() method. For example:
You can find the full runnable VS example in the attached archive.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
This solved my issue of trying to accomplish centering the radwindow based on the browser size or resize.