Resizing RadWindow within a master page

4 posts, 1 answers
  1. CBARS
    CBARS avatar
    55 posts
    Member since:
    Sep 2008

    Posted 18 Jun 2009 Link to this post

    Hi,

    I have a RadWindow on a page that gets put into a contentplaceholder on a master page. Is there any way to make the Window open at position 0,0 of the master page?
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 18 Jun 2009 Link to this post

    Hi CBARS,

    Yes, this is possible and I recommend you use the following approach :

    <script type="text/javascript"
        function openRadWindow() 
        { 
            var oWindow = window.radopen("http://www.telerik.com""RadWindow1"); 
            oWindow.moveTo(0, 0); 
        } 
    </script> 

    Every time when a RadWindow is opened it will positioned to the top-left corner of the browser window. For your convenience I have attached a full demo to the thread.

    I hope this helps.

    All the best,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. CBARS
    CBARS avatar
    55 posts
    Member since:
    Sep 2008

    Posted 18 Jun 2009 Link to this post

    Hi Fiko,

    Thanks for your speedy response.

    I have put the MoveWindow function in the OnClientShow event as i need server side code to execute first. So instead I used the GetRadWindow function to identify the window and the MoveWindow function to move it, however it doesn't work and i get and Object Required error. I'm sure I'm making a silly mistake, any further help would be greatly appreciated.

    function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                
            return oWindow;
        }
        
        function MoveWindow()
        {
            var oWindow = GetRadWindow();
            oWindow.moveTo(0, 0);
        }
  4. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 18 Jun 2009 Link to this post

    Hi CBARS,

    The GetRadWindow() function is used in order to get reference to the RadWindow object on the page that is opened in a RadWindow and contains that function's declaration. That is why, in your scenario the GetRadWndow() function returns 'null' and this is expected, because the page is not opened inside a RadWindow object. In your case you need to use the following approach :

    <script type="text/javascript"
        function OnClientShow(oWindow, args) 
        { 
            oWindow.moveTo(0, 0); 
        } 
    </script> 

    The first passed argument to the OnClientShow handler is the caller object ( RadWindow object).

    I hope this helps.

    Greetings,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top