How to set the Size of Window?

2 posts, 0 answers
  1. Jiten
    Jiten avatar
    67 posts
    Member since:
    Dec 2010

    Posted 06 Apr 2012 Link to this post

    Hello,
    I  used the following script for open the radwindow from another radwindow. It is work but i want  to size(width,height) the window.
    I can't unsertand how to set the size in this script.
     <telerik:RadScriptBlock runat="server" ID="test1_script">
        <script type="text/javascript">
            var test1Wnd;
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.RadWindow; //Will work in Moz in all cases, including clasic dialog       
                else if (window.frameElement && window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow; //IE (and Moz as well)       
                return oWindow;
            }
            function open_fromTest1() {
                var oBrowserWindow = GetRadWindow();
                if (oBrowserWindow) oBrowserWindow = oBrowserWindow.BrowserWindow;
                if (oBrowserWindow == null) {
                    window.radopen("Default2.aspx" + "", "NewWindow1");
                    
                }
                else {
                    setTimeout(function() {
                        test1Wnd = oBrowserWindow.radopen("Default2.aspx", "NewWindow1");
                       
                    }, 0);
                }
            }
        </script>
    </telerik:RadScriptBlock>
    and I used the RadButton:
    <telerik:RadButton ID="cmdPrint" runat="server" SkinID="Button" AutoPostBack="false" Text="Print Prescription" OnClientClicked="open_fromTest1" />

    I also added this: window.onresize(600, 1000);
    It is not work.

    Please help me as soon as possible.

    Thanks and Regards
    Jiten Mutum


  2. rdmptn
    rdmptn avatar
    72 posts
    Member since:
    Aug 2011

    Posted 09 Apr 2012 Link to this post

    You only need to use the RadWindow's client-side API: http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html. Once you have the reference (it is returned by radopen(), and you use it - the test1Wnd variable) you can use the setSize() method on it.

    As for window.onresize - this is a standard browser event and what you have attached will result in a JavaScript error. It needs a function name or a variable of type function that will be its event handler, so you need to remove it. A RadWindow instance is not the same as the window object each browser frame has.
Back to Top