Position Model Window

4 posts, 0 answers
  1. B
    B avatar
    42 posts
    Member since:
    Jan 2010

    Posted 11 Aug 2011 Link to this post

    how do you postion a model dialog?

    i have radwindowmanager on page
    i set the left and top property of the radwindowmanager to 50, 50
    when user clicks button i call client side script that calls "radopen"
    the dialog is always centered in the middle of the screen.
    i would like to postion it about 50 pixes from the top of the page.

    thanks in advance.

    PS, i also tried setting OnClientBeforeShow on radWindowManager and calling the moveTo method.  That doesn't work either.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 12 Aug 2011 Link to this post

    Hello B,

    Try the following Javascript to change the position of the modal window.
    JS:
    <script type="text/javascript" language="javascript">
    function openAlert()
    {
       var oAlert = radalert();
       oAlert.MoveTo(300, 100);//change the values according to your resolution to get the desired result
    }
    </script>

    Thanks,
    Princy.
  3. B
    B avatar
    42 posts
    Member since:
    Jan 2010

    Posted 12 Aug 2011 Link to this post

    Thanks, but how does this get called?  What event handler do i link it up to?  I tried the moveTo in the beforeOpen event and it didn't work.
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4630 posts

    Posted 16 Aug 2011 Link to this post

    Hi guys,

    The general behavior of a modal RadWindow is to be centered on the page and thus ignore the Left and Top properties if they are present. This behavior is by design as generally modal dialogs popup in the center of the screen to make sure they will take the user's attention.

    The way to move such a RadWindow is by calling moveTo() after it is shown, i.e. either in the OnClientShow event, or immediately after calling radopen, for example:
    function openRadWindow()
    {
        var oWnd = radopen(null, null);
        oWnd.moveTo(50, 50);
    }

    or with the OnClientShow handler:
    function OnClientShow(sender)
    {
        setTimeout(function ()
        {
            sender.moveTo(50, 50);
        }, 0);
    }



    All the best,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top