Page1 refresh when Page2 close

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chuuburg
    New Member
    • Nov 2009
    • 1

    Page1 refresh when Page2 close

    Hi, can anyone help me with this.

    I have 2 pages, Page 1 is the main page while Page 2 is a flash page. When i close Page 2, I would like page 1 to be refreshed/re-retrieve from database because i need the data in the main page to be updated as data in the database will be changed when i am going through the flash pages.

    Page2 is opened when a link in Page1 is clicked

    i am using visual studio 2008 VB language

    Thanks
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    When you refer to "Page" do you mean Browser Windows?
    Is "Page1" the parent browser window to "Page2" (the child browser window)?

    You cannot do this using ASP.NET code (by this I mean your VB.NET code). Your VB.NET code runs on the server and it has absolutely no control over what happens with the browser.

    You are going to have to use JavaScript for this purpose.

    What you need to do (if you're talking about browser windows) is implement a JavaScript method in "Page1" (the parent window) that will postback to the server so that the page can be refreshed.

    In "Page2" (the child window) you will have to implement a method that executes when the browser window closes. The only way (that I know of) to check when the window is being closed this is to use the JavaScript onbeforeunload event (this event is not supported by Opera at this time).

    So when the onbeforeunload event happens in the child browser, you have to call the JavaScript method that posts back to the server in the parent window. You can use the window.opener to accomplish this.

    I've moved your question to the JavaScript forum.

    -Frinny

    Comment

    Working...