Close Pop-up window and reload parent page

Discussion in '.NET' started by vseshan204, Mar 6, 2009.

  1. vseshan204

    vseshan204

    Joined:
    Mar 6, 2009
    Messages:
    2
    Hi,
    I have a parent page with a dropdown box. The dropdown box is connected to a database. Here is how it functions....when you select the value "Add Names", a pop-up window opens up. This pop-up window has text box and a button. The user is expected to type a new name and click the button, upon doing that the name gets loaded into the database and closes the pop-up window.
    Upon closing the window, I want the parent page to be refreshed such that the drop down box has the new name listed....and this is where I am not sure of.

    Here is how my code looks in the pop-up window..

    this.RegisterStartupScript("CloseAndReload", @"
    <script language='javascript'>
    window.close();
    </script>
    ");

    Can someone help me with this please.

    Thanks,
    VS
    vseshan204, Mar 6, 2009
    #1
    1. Advertising

  2. vseshan204

    vseshan204

    Joined:
    Mar 6, 2009
    Messages:
    2
    I also wanted to add that my parent page has other text boxes which have been filled with some values. So when I reload the parent page from the pop-up window, I would want the page to retain those text box values too.

    Thanks,
    VS
    vseshan204, Mar 6, 2009
    #2
    1. Advertising

  3. vseshan204

    pavanip

    Joined:
    Sep 16, 2008
    Messages:
    1
    you can use the following one line of code to close popup window and at the same time it refresh the parent page.
    Page.RegisterStartupScript("CLOSE", "<script language='javascript'>window.opener.location.reload();self.close();</script>");

    happy coding
    good luck
    pavanip, Jun 19, 2009
    #3
  4. vseshan204

    Vangi

    Joined:
    Jul 27, 2009
    Messages:
    3
    This work for me:
    RegisterStartupScript("CloseWindow", "<script type=\"text/javascript\">window.opener.location.reload(false);self.close();</script>");
    Vangi, Jul 27, 2009
    #4
    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. J P Singh
    Replies:
    3
    Views:
    288
    Howard Rothenburg
    Feb 11, 2004
  2. DROdio
    Replies:
    1
    Views:
    90
    Lasse Reichstein Nielsen
    Jul 20, 2003
  3. PWalker
    Replies:
    1
    Views:
    129
    David Lionetti
    Feb 24, 2005
  4. Madame Blablavatsky
    Replies:
    8
    Views:
    156
    Dr John Stockton
    Sep 16, 2005
  5. carrajo
    Replies:
    2
    Views:
    122
    scripts.contact
    May 21, 2007
Loading...

Share This Page