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

Position Model Window

3 Answers 74 Views
Window
This is a migrated thread and some comments may be shown as answers.
B
Top achievements
Rank 1
B asked on 12 Aug 2011, 12:53 AM
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.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Aug 2011, 05:21 AM
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.
0
B
Top achievements
Rank 1
answered on 12 Aug 2011, 01:39 PM
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.
0
Marin Bratanov
Telerik team
answered on 16 Aug 2011, 11:59 AM
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.

Tags
Window
Asked by
B
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
B
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or