Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > How to center RadWindow and maintain it position while scrolling
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered How to center RadWindow and maintain it position while scrolling

Feed from this thread
  • DMC Helpdesk avatar

    Posted on Apr 2, 2008 (permalink)

    Just wanted to share this code with you.This works with IE and Firefox.The Radwindow will always open in the center of the parent window even after you scroll the parent window:

    <script type="text/javascript">
     
    var w = 480, h = 340;

    if (document.all) {
      
       w = screen.availWidth;
       h = screen.availHeight;
     
    }
    else
    {
     w = window.innerWidth;
      h = window.innerHeight;
    }

    var popW = 630, popH = 500;//change this to match your RadWindow Width and Height

    var leftPos = (w-popW)/2;
    var topPos = (h-popH)/2;

     function OnClientShow(radWindow)
            {
                if(document.documentElement && document.documentElement.scrollTop)
                {
               
                 radWindow.MoveTo(leftPos,topPos+document.documentElement.scrollTop);

                   
                }
         else if(document.body)
                {
               
                 radWindow.MoveTo(leftPos,topPos);

                }
            }

    </script>



  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Apr 2, 2008 (permalink)

    Hi DMC,

    Thank you for sharing your code with us. I would like only to suggest to try with the Center() method - basically it does the same as your code.
    e.g. 

    function OnClientShow(radWindow)
    {
        radWindow.Center();
    }


    I hope this helps.



    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  • Posted on Apr 21, 2011 (permalink)

    Hi Giorgi,

    Please, how can I disable resize option and possibility to move radwindow.

    I´m using the latest version of asp.net ajax radcontrols.

    Thanks, best

    Daniel

  • Marin Bratanov Marin Bratanov admin's avatar

    Posted on Apr 26, 2011 (permalink)

    Hi Daniel,

    You can use the Behaviors property and set the desired behaviors in the markup. You can set it to None, for example, or to Maximize, Minimize. In this manner you can select the desired combination of the enabled behaviors. You can also set also it in the code-behind. You can see it in action in the following online demo: http://demos.telerik.com/aspnet-ajax/window/examples/behaviors/defaultcs.aspx.

    In your case you would most likely need to include the desired behaviors and not include Resize and Move.



    All the best,
    Marin
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  • Posted on Apr 28, 2011 (permalink)

    Hi Marin,

    Thanks for response.

    Works very well.

    Abraço, best

    Daniel

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Window > How to center RadWindow and maintain it position while scrolling