Results 1 to 7 of 7

Thread: Is there a way to refresh one ASP.NET page from another?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    122

    Question Is there a way to refresh one ASP.NET page from another?

    Is there a way to refresh one ASP.NET page when a button on a second ASP.NET page is clicked (assuming both pages are part of the same application)?

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    If the window was opened with an ID:

    Page.Controls.Add(new LiteralControl("<script language=""javascript"">theotherwindowid.document.reload();</script>"))
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    122
    The page that is to be reloaded was opened first (i.e. when the user navigated to the Website). How can I find out what the window ID is if I didn't set it? If I can do this, then I can store it in a session variable and use the code you posted below.

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    If you didn't set it, then it's out of scope.

    Think of ir being private. If it's not part of your app, then by definition of being private, you cannot access it.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    122
    So, is there any other way to do it? The scenario is as follows:

    I have an ASP.NET page with an IFRAME. The IFRAME contains the second ASP.NET page. I need to be able to click on an "update" button on the page within the IFRAME and have the browser refresh. If I use the META refresh, it will only refresh the page within the frame...not the main page in the browser.

  6. #6
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    In that case, the following should work (I've done exactly what you describe already):

    Code:
            JavaScript = "<script language=""javascript"">" & vbCrLf
            JavaScript += "parent.location.reload();" & vbCrLf
            JavaScript += "</script>"
            Response.Write(JavaScript)
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    122
    I tried this last bit of code and it works perfectly! Thanks for the help...much appreciated!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width