Open window on page load

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Open window on page load

    Hi,
    I create a window by clicking on a button which uses the following script:
    function createWindow(urls, winid, wintitle) {
                var w = new Ext.Window(Ext.apply({renderTo: Ext.getBody(),
                    id: winid,
                    title: wintitle,
                    width: 520,
                    height: 355,
                    maximizable: false,
                    minimizable: false,
                    showMask: true,
                    modal: true,
                    autoLoad: {
                    url: urls + window.location.search,
                        mode: "iframe",
                        showMask: true
                    }
                }));
                w.on("render", function() { this.iframe.dom.contentwindow.parentWindow = this; }, w, { delay: 10 });
                w.center();
                w.show();
            }
    1. Is it possible to call and open the window in Page_Load? If it's possible, how?

    I also tried to pass two parameters for width and height to the above script, but it doesn't work. I am trying to use one script with different window size.
    1. Is it possible?

    Thanks for your help.
    Kamal
  2. #2

    RE: Open window on page load



    Hi everyone,

    Has anyone got any solution for my problem? Thanks.

    Kamal
  3. #3

    RE: Open window on page load



    1. Just add the script on server side:
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Coolite.Ext.Web.Ext.IsAjaxRequest AndAlso Not IsPostBack Then
                Dim myUrl = "someurl"
                Dim myWinID = "win"
                Dim myWinTitle = "My Page"
                Dim script = String.Format("createWindow('{0}','{1}','{2}');", myUrl, myWinID, myWinTitle)
                Coolite.Ext.Web.ScriptManager.GetInstance(Me.Page).AddScript(script)
            End If
        End Sub
    2. It should be fine. What's the error you are getting? Try the below script. Dont think you need Ext.apply.
    function createWindow(urls, winid, wintitle, width, height) {
                var w = new Ext.Window({
                    renderTo: Ext.getBody(),
                    id: winid,
                    title: wintitle,
                    width: width || 520,
                    height: height || 355,
                    maximizable: false,
                    minimizable: false,
                    showMask: true,
                    modal: true,
                    autoLoad: {
                        url: urls + window.location.search,
                        mode: "iframe",
                        showMask: true
                    }
                });
                w.on("render", function() { this.iframe.dom.contentwindow.parentWindow = this; }, w, { delay: 10 });
                w.center();
                w.show();
            }
  4. #4

    RE: Open window on page load



    Hi Jchau,
    Thanks for your solution. One more question regarding your first solution, would it show the window on page load?

    Kamal
  5. #5

    RE: Open window on page load




    Yes, it will should show the window the first time the page is loaded.

Similar Threads

  1. Replies: 8
    Last Post: Oct 22, 2012, 1:55 PM
  2. [CLOSED] Open parent window from child page using DirectEvent?
    By tjshin in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 15, 2012, 2:25 PM
  3. Replies: 2
    Last Post: Oct 11, 2011, 1:15 PM
  4. [CLOSED] Open a Window in a parent page
    By Immobilmente in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 07, 2009, 4:10 AM
  5. Open a window and load a page with Javascript
    By Neeraj Sharma in forum 1.x Help
    Replies: 2
    Last Post: Jan 17, 2009, 1:12 AM

Posting Permissions