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

Initial RadWindow PageSize

4 Answers 179 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shailendra
Top achievements
Rank 1
Shailendra asked on 19 Aug 2008, 03:17 PM
Hi,

I was wondering if there is any way of setting the window size on page init and get that size on initial radwindow display? Not sure if that makes sense, so I will explain in detail.

I have numerous pages from where I open different radwindows. Up until now, I was specifying the size while creating an instance of it.

/* Show new RAD window */ 
function ShowRADWindow(URL,Title,Width,Height,Modal,Behaviors) { 
    var oWindow = window.radopen(URL, null); 
    //Using the reference to the window its clientside methods can be called 
    oWindow.SetSize (Width, Height); 
    oWindow.SetTitle (Title); 
    oWindow.set_modal(Modal); 
    oWindow.setActive(true); 
    oWindow.center();   
    if (Behaviors!=null && Behaviors!='') 
        oWindow.set_behaviors(Behaviors); 
 
    //PositionWindow(oWindow); 


But, now, I dont want to specify height and width while opening, instead I want to specify in the radwindow page_init(). All radwindows are of different sizes. I tried to do this, but initially it shows a very small sized window and then resizes it. I dont want this resize event to occur.

Is there any way to do it?

Thanks,
~SP

4 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 20 Aug 2008, 12:35 PM
Hello Shailendra,

If the size of the windows is not pre-set in the RadWindow's declaration, the resizing will always happen. What I can suggest in your case however is to initially open the RadWindow outside of the viewable area of the browser (for example you can set Top and Left to high, negative values) and after the resizing is done you can move them in the viewport by using the center() or moveTo() methods.

I hope this helps.

All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shailendra
Top achievements
Rank 1
answered on 20 Aug 2008, 09:37 PM
Hi Georgi,

I tried using Top and Left properties but all I could achieve is window at the left-top corner even after using high negative values (-10000,-10000).

So, I tried Hide and Show methods but the problem with this is that it takes sometime to load the window. Until then user sees a disabled browser window.

Finally, what I did is I minimized the window initially and restored it after resizing. This looks fine but I am unable to center this window.


/* Show new RAD window */ 
function ShowRADWindow1(URL,Title,Modal,Behaviors) { 
    var oWindow = window.radopen(URL, null); 
    //Using the reference to the window its clientside methods can be called 
    oWindow.SetTitle ("Opening..."); 
    oWindow.set_modal(Modal); 
    oWindow.setActive(true); 
    //oWindow.moveTo(10000,10000); 
    //oWindow.hide(); 
    oWindow.minimize(); 
    oWindow.center();   
 
    if (Behaviors!=null && Behaviors!='') 
        oWindow.set_behaviors(Behaviors); 
 
    //PositionWindow(oWindow); 

 Public Sub SetPopupSize(ByVal width As Integer, ByVal height As Integer) 
        AjaxPanel.ResponseScripts.Add("GetRadWindow().SetSize(" & width.ToString & "," & height.ToString & ");") 
        ' position radwindow 
        AjaxPanel.ResponseScripts.Add("var oWindow = GetRadWindow(); oWindow.center();") 
        'AjaxPanel.ResponseScripts.Add("var oWindow = GetRadWindow(); oWindow.restore();") 
 
    End Sub 


Do you have any suggestion on how to center it?

0
Georgi Tunev
Telerik team
answered on 21 Aug 2008, 11:46 AM
Hi Shailendra,

Try using restore() before centering it. As for the Top and Left problem - make sure that the KeepInScreenBounds property is set to false - otherwise the RadWindow will always be visible when shown.

If you still experience this problem, please open a support ticket and send me a small sample project where I can examine your setup. Make sure that the project can be run locally and attach it to the support thread - I will check it right away.


All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shailendra
Top achievements
Rank 1
answered on 21 Aug 2008, 02:47 PM
Thanks Georgi. It didnt work for the first time but worked when I rebuilt the solution.
Tags
Window
Asked by
Shailendra
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Shailendra
Top achievements
Rank 1
Share this question
or