Window size after resizing

4 posts, 0 answers
  1. erniej
    erniej avatar
    28 posts
    Member since:
    Sep 2006

    Posted 01 Sep 2008 Link to this post

    Good Morning,

    I am wanting to obtain the height and width of a RadWindow in client side javascript, after the window has been resized by the user.

    My current code handles the OnResize event of the window as follows

    function SetMapSize(sender, EventArgs)
        var width = sender.get_width();
        var height = sender.get_height();

    Unfortunately this returns only the original size of the window not the new size after resizing. 

    Much appreciated.

    Ernie Josefik

  2. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 02 Sep 2008 Link to this post

    Hello Ernie,

    Indeed, as noted in the documentation, these methods will return the initial size only. To get the current one, you must use the getWindowsBounds() method - more information on it is available in the same documentation's page.

    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft R3 2016 release webinar banner
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Sep 2008 Link to this post


    Try the following JavaScript code.

     <script type="text/javascript" language="javascript" > 
         function OnClientResize(oWnd) 
          var bounds = oWnd.getWindowBounds(); 

  5. erniej
    erniej avatar
    28 posts
    Member since:
    Sep 2006

    Posted 02 Sep 2008 Link to this post

    Thank you George and Shinu,

    For some unexplicable reason I looked everywhere in the Documentation and on the forums except the correct page.

    I've now tried getWindowsBounds() and it seems to return the external dimensions of the window (i.e. including scroll bars, title bar and status bar).  Looking into the properties of the object returned by the getContentFrame() method I found clientWidth and clientHeight.  These seem to return the correct size of the content section of the window so I have ended up using these.




Back to Top