• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 556
  • Last Modified:

Popup close & redirect

If I run into an error in a popup while processing VB.Net code on page_load, how can I redirect the main window that opened the popup to an error page and close the popup window? I'm not having much luck doing this from VB.net (2005 if it matters).
0
JeepGeekin
Asked:
JeepGeekin
  • 2
  • 2
1 Solution
 
RejojohnyCommented:
u will have to render a client side script for redirecting ur main page and then closing the current window .. use Page.RegisterClientScriptBlock

Dim scriptString As String  = "<script language=JavaScript> parent.document.location.href = 'ErrorPage.aspx';"
scriptString += "window.close();"
scriptString += "</script>"

Me.RegisterClientScriptBlock("ClientScript", scriptString)

Rejo

0
 
SystemExpertCommented:
plz find the following link

http://p2p.wrox.com/topic.asp?TOPIC_ID=14960

Thanks
0
 
JeepGeekinAuthor Commented:
Thanks. Sorry. I moved on to another problem & forgot I posted this.
Rejo. To test it, I added your code to the Page_Load of an aspx popup page & called the popup page from another page.

What happened was that the popup closed, but the page that called it didn't do anything. I can's say I follow this enough to troubleshoot it. I guess Parent in a popup window is the calling page. Does anything else need to be done here between these 2 pages? I'll bump this up 100 points.

SystemExpert, thanks, but that link didn't help me. It was for opening a popup from another popup & redirects within the popup window.
0
 
RejojohnyCommented:
try ..
window.opener.document.location.href = 'ErrorPage.aspx'
0
 
JeepGeekinAuthor Commented:
That did it. Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now