Modal RadWindow position - always in the center

12 posts, 0 answers
  1. Sphengle
    Sphengle avatar
    29 posts
    Member since:
    Sep 2007

    Posted 21 Apr 2010 Link to this post

    Anyone know how to set the position of a RadWindow when it is modal.  Not matter what Left, Top or OpenerElementID property values you set it always appears in the centre.  In my app the centre happens to be a very bad place for it.


     <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista" > 
                    <windows> 
                        <telerik:RadWindow   
                            ID="RadWindow1"   
                            runat="server"   
                            ShowContentDuringLoad="False"   
                            Width="400px" 
                            Height="350px"   
                            Title="Action..." 
                            VisibleStatusbar="False"   
                            style="display:none;"   
                            Behavior="Close"   
                            InitialBehavior="None"                         
                            Modal="True"   
                            NavigateUrl=""                          
                            Behaviors="Close" 
                            Left="0" Top="0"   
                            OpenerElementID="fsMyActivities" 
                              
                             > 
                        </telerik:RadWindow> 
                    </windows> 
                </telerik:RadWindowManager> 

    The window is being opened using radopen() in JavaScript.


    Thanks

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 21 Apr 2010 Link to this post

    Hello Sphengle,

    By design a modal RadWindow will always be shown in the page's center. If you want to move it somewhere else, you should use moveTo() after showing the popup. 

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sphengle
    Sphengle avatar
    29 posts
    Member since:
    Sep 2007

    Posted 21 Apr 2010 Link to this post

    Hi Georgi

    Sorry , still can't get it to budge.  I'm doing this....

    var oWnd = radopen(url, "RadWindow1");  
    oWnd.moveTo( 5, 5 ); 

    It opens OK as usual but doesn't move.

  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 21 Apr 2010 Link to this post

    Hi Sphengle,

    I tried your code and everything is working as expected on my side (see attached movie). Could you please open a support ticket and send me a small sample project where the problem could be reproduced? I will check it and get back to you right away.


    Greetings,
    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.
  6. Sphengle
    Sphengle avatar
    29 posts
    Member since:
    Sep 2007

    Posted 21 Apr 2010 Link to this post

    Hi Georgi

    I managed to solve the problem by removing the OpenerElementID from the Window definition.  The moveTo() method now works as expected.

    Regards
  7. Jan Mracek
    Jan Mracek avatar
    1 posts
    Member since:
    Jun 2004

    Posted 13 May 2010 Link to this post

    I have similar problem, after update from dll from 2009 to 2010 client method set_offsetElementID doesn't work for modal window.

    Jaroslav
  8. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 13 May 2010 Link to this post

    Hi Jan,

    If the window is modal, it will always be displayed in the center of the page, no matter if there is an offset element set. Please use moveTo() to position the modal window in the desired location.


    Regards,
    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.
  9. J2K
    J2K avatar
    33 posts
    Member since:
    Sep 2005

    Posted 01 Aug 2010 Link to this post

    Using moveTo() works as explained in this thread, except when the RadWindow is animated.  When animated, and setting the window's modal property to true, the Window is centered and since I'm working on a fairly tall window, I do need it positioned carefully. Is there a work around for positioning a modal, animated window?

    Here's the Window's tag:

    <

    telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Windows7" DestroyOnClose="True" Modal="True" ReloadOnShow="True" Width=900 Height=600 VisibleStatusbar="False" Animation="Resize" Left="1px" Top="1px">

     

     

    </telerik:RadWindowManager>

     


    Here's the script for opening the window on selection of a row in a RadGrid:

     

    function OpenWindow(sender, args)

     

    {

     

    var cid= args.getDataKeyValue("ClientID");

     

     

    //alert( args.getDataKeyValue("ClientID"));

     

     

    var wd = window.radopen("Client.aspx?ClientID=" + cid , "DialogWindow");

     

    wd.set_height(650);

    wd.set_width(900);

    wd.moveTo(1,1);

     

     

    return false

     

    }

    Note that with animation, the script's set_height, set_width, and moveto lines are all ignored, as are the tag's left/top properties.

    We always need to use your modal feature as we are displaying a form for data entry.  Your animation property is a nice feature, and would like to use if possible.  Thanks.

  10. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 04 Aug 2010 Link to this post

    Hello J2K,

    I am afraid that for your code to work, you should not use animation. The animation feature of the window control include complex calculations and while in theory we can add a check if the window object is additionally moved on the page while shown (and act accordingly), such check will make the code even more complex and will severely degrade the performance.

    Kind regards,
    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
  11. J2K
    J2K avatar
    33 posts
    Member since:
    Sep 2005

    Posted 05 Aug 2010 Link to this post

    Georgi ... thanks for the explanation, I appreciate it.  Your animation feature is very good, but we can certainly live without it for this particular purpose.
  12. mkavici
    mkavici avatar
    2 posts
    Member since:
    Nov 2007

    Posted 08 Feb 2014 Link to this post

    to keep RadWindow on center its css position must be fixed.
    Using Jquery you can change position absolute to fixed on window load.

    $(window).load(function () {
        if ($(".RadWindow").length > 0) {
            $(".RadWindow").css("position", "fixed").css("top", "250px");
        }
    });
  13. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 10 Feb 2014 Link to this post

    Hi guys,

    You can now set positions for a modal RadWindow: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-positioning-modal-popup.html.
    In case you do not want RadWindow to scroll with the rest of the page you can either override its CSS position to fixed, or use its Pin behavior:
    - manually click the pin icon
    - OR set it as an initial behavior to the control: http://www.telerik.com/help/aspnet-ajax/window-behavior-initial-window-state.html.
    - OR pin it with a few lines of code in the OnClientShow event:
    function OnClientShow(sender, args) {
        if (!sender.isPinned())
            sender.togglePin();
    }



    Regards,
    Marin Bratanov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017