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

Display Rad Window in Top Left corner of browsers

10 Answers 509 Views
Window
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 14 Jun 2010, 10:31 AM
hi,

I have a button. On click of the button (server side) i am displaying a rad window(modal). What should i do to display the rad window in the 'top-left corner' of the browser instead of center.

Regards,
Shashank V

10 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Jun 2010, 01:30 PM
Hello Shashank,

Try the following client code in order to move the modal popup window to desired location.

client code:
 
<script type="text/javascript">  
    function OnClientShow(sender, args) {  
        sender.moveTo(0, 0); // move to top left  
    }  
</script> 
Attach OnClientShow eventto RadWindow.

Thanks,
Princy.
0
Petio Petkov
Telerik team
answered on 14 Jun 2010, 02:06 PM
Hi,

You should set the RadWindow's Top and Left properties to "0px" , e.g.
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
            <Windows>
                <telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="http://www.google.com"
                    Top="0px" Left="0px" VisibleOnPageLoad="true">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </div>
    </form>
</body>
</html>
Let us know if you have any other questions.

Sincerely yours,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
saravanan k
Top achievements
Rank 1
answered on 16 Jun 2010, 05:53 AM
Hi,

Thanks Princy for the info. Works perfectly fine.

I have got a new requirement.

My page is very lengthy and the button ( on click: I am displaying the rad modal window) is at the bottom of the page. In this scenario, the window appears at the top left corner and the users have to scroll up to view it. Is there a way by which the window can be viewed on top-left corner of the current section of the page being displayed, so that users need not scroll up.

Regards,
Shashank
0
Petio Petkov
Telerik team
answered on 16 Jun 2010, 10:06 AM
Hi,

You can Pin the RadWindow to the top-left corner via the togglePin client-side method, e.g.
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head id="Head1">
    <script type="text/javascript">
        function WindowShow(oWin, args)
        {
            var isPinned = oWin.isPinned();
            if (!isPinned)
            {
                oWin.togglePin();
            }
        }
    </script>
</head>
<body class="BODY">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true" NavigateUrl="http://www.google.com"
                Top="0px" Left="0px" OnClientShow="WindowShow">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <div style="width: 5000px; height: 5000px">
    </div>
    </form>
</body>


All the best,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
saravanan k
Top achievements
Rank 1
answered on 18 Jun 2010, 09:26 AM
Hi,

Thanks for the info.

Now, How do I combine the solutions of 2nd post and the previous post. Left="0px" and Right="0px" does not seem to work for RAD 'Modal' window.

I need to pin the window, at the sametime, I need it to be displayed in the top-left section of the page being displayed, and the window must be a modal type.

Regards
Shashank V
0
Georgi Tunev
Telerik team
answered on 21 Jun 2010, 12:42 PM
Hi Shashank,

A modal RadWindow will always be displayed in the center of the page. If you want, you can move it to a desired position after that (by using moveTo()), but initially it will always be centered.


Sincerely yours,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
cyguo
Top achievements
Rank 1
answered on 21 Jul 2011, 04:57 AM
Hi,
How do I move the RadWindow to the bottom-right corner which depends on browser size?
thank you.
0
Marin Bratanov
Telerik team
answered on 21 Jul 2011, 12:57 PM
Hi C.Y. Guo,

I would recommend using the Telerik Static Client Library and its getClientBounds() method in combination with the RadWindow client-side API -  attach the function that will move the RadWindow to the browser resize event as well by calculating its size and subtracting it from the browser window size.

For your convenience I created and attached a simple page illustrating the approach. Please note that you may need to alter the timeout, as slower machines may temporarily produce scrollbars which will position the RadWindow a bit wrong.

Feel free to use this sample as a basis for your further development and extend it further to match your needs.


Best wishes,
Marin
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
cyguo
Top achievements
Rank 1
answered on 22 Jul 2011, 07:02 AM
Hi, 

I wonder if RadWindow shows a few seconds later?
thank you :)
0
Marin Bratanov
Telerik team
answered on 22 Jul 2011, 04:09 PM
Hi C.Y. Guo,

I am not sure I understand what you mean, but you can about always add/increase the timeout in the setTImeout() function. You could also call the RadWindow's show() method with a timeout to ensure it will show after a certain amount of time. If this does not cover your scenario please explain in some more detail what you are unable to implement from my sample.


Regards,
Marin
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Window
Asked by
saravanan k
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Petio Petkov
Telerik team
saravanan k
Top achievements
Rank 1
Georgi Tunev
Telerik team
cyguo
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or