Window.Close Opens New Annoying Window

Discussion in 'ASP .Net' started by Vijay Kerji, Dec 1, 2004.

  1. Vijay Kerji

    Vijay Kerji Guest

    Hi,
    Please go through the following scenario.
    1)On Button click, Parent window opens a child window using
    showModalDialog
    2)Button is a server control and showModalDialog script is registered
    using the following code:

    string scriptblock = "<script language='javascript'>returnValue =
    window.showModalDialog('Datagrid1.aspx', 'xxx');" +
    "if(returnValue == 0) window.open('Webform1.aspx', '_self'); else
    window.open('Datagrid1.aspx', '_self'); </script>";
    Page.RegisterStartupScript("Launch_Report_Window",scriptblock);

    3)In the Child window there is a SAVE server button control and the
    following
    code is added in PageLoad for the button:
    Button_Save.Attributes.Add("onclick","javascript:window.returnValue
    = 0;window.close();");

    4)When OnSave button is clicked, a new child window is getting opened
    though the modal window is closed, which is annoying.

    Any intelligent guess/suggestoins are appreciated.

    Thanks


    Vijay K Kerji
     
    Vijay Kerji, Dec 1, 2004
    #1
    1. Advertising

  2. Vijay Kerji

    Mark Rae Guest

    "Vijay Kerji" <> wrote in message
    news:...

    > Any intelligent guess/suggestoins are appreciated.


    Postback of a modalDialog will post back to a new window unless you
    encapsulate the entire code in an <iframe> tag.
     
    Mark Rae, Dec 1, 2004
    #2
    1. Advertising

  3. Vijay,

    Try putting a line

    <base target=_self>

    in the <Head> section of the page shown in the modal window.

    Eliyahu

    "Vijay Kerji" <> wrote in message
    news:...
    > Hi,
    > Please go through the following scenario.
    > 1)On Button click, Parent window opens a child window using
    > showModalDialog
    > 2)Button is a server control and showModalDialog script is registered
    > using the following code:
    >
    > string scriptblock = "<script language='javascript'>returnValue =
    > window.showModalDialog('Datagrid1.aspx', 'xxx');" +
    > "if(returnValue == 0) window.open('Webform1.aspx', '_self'); else
    > window.open('Datagrid1.aspx', '_self'); </script>";
    > Page.RegisterStartupScript("Launch_Report_Window",scriptblock);
    >
    > 3)In the Child window there is a SAVE server button control and the
    > following
    > code is added in PageLoad for the button:
    >

    Button_Save.Attributes.Add("onclick","javascript:window.returnValue
    > = 0;window.close();");
    >
    > 4)When OnSave button is clicked, a new child window is getting opened
    > though the modal window is closed, which is annoying.
    >
    > Any intelligent guess/suggestoins are appreciated.
    >
    > Thanks
    >
    >
    > Vijay K Kerji
     
    Eliyahu Goldin, Dec 1, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. robertm
    Replies:
    1
    Views:
    830
    Vidar Petursson
    Aug 11, 2003
  2. Iñaki Baz Castillo
    Replies:
    7
    Views:
    894
    Iñaki Baz Castillo
    Jan 12, 2010
  3. gopal srinivasan
    Replies:
    0
    Views:
    245
    gopal srinivasan
    Nov 5, 2004
  4. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    395
    Gérard Talbot
    Sep 2, 2005
  5. Jaggu
    Replies:
    7
    Views:
    229
    Thomas 'PointedEars' Lahn
    May 22, 2006
Loading...

Share This Page