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

RadGrid PopUp Centered

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexandre Lepage
Top achievements
Rank 1
Alexandre Lepage asked on 01 May 2009, 12:48 PM
Good Morning,

How can I center a PopUp form in a browser window.

I saw the script sample provided in the documentation... but it centered the window according to the grid position in the page.
What I want is center base on the browser window, not the content. Like a Radwindow if I can say

Thanks!

1 Answer, 1 is accepted

Sort by
0
Alexandre Lepage
Top achievements
Rank 1
answered on 01 May 2009, 02:24 PM
got it from another post


<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
<script type="text/javascript"
   var popUp; 
   function PopUpShowing(sender, eventArgs) 
   { 
       var popUp = eventArgs.get_popUp(); 
       var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px")); 
       var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px")); 
       var windowHeight = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.body.offsetHeight); 
       var windowWidth = document.body.offsetWidth; 
        
       if (popUpHeight == "") popUpHeight = 300; // if the height isn't set on the popup, default to 300px   
       popUp.style.position = "fixed"
       popUp.style.left = (Math.floor((windowWidth - popUpWidth) / 2)).toString() + "px"; 
       popUp.style.top = (Math.floor((windowHeight - popUpHeight) / 2)).toString() + "px"; 
   } 
   </script> 
</telerik:RadCodeBlock> 
 

Tags
Grid
Asked by
Alexandre Lepage
Top achievements
Rank 1
Answers by
Alexandre Lepage
Top achievements
Rank 1
Share this question
or