Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reloading a calling page

Status
Not open for further replies.

tbubbs

Programmer
Mar 30, 2001
26
CA
I have a popup window and after selecting a value from this window I need to be able to close it and reload the page that called it. I used this code in my aspx.vb file:

Response.Write(&quot;<SCRIPT language='javascript'>&quot;)
Response.Write(&quot;window.opener.location.reload(true);&quot;)
Response.Write(&quot;self.close();&quot;)
Response.Write(&quot;</SCRIPT>&quot;)

However when I run this code I receive this IE message:

The page cannot be refreshed without resending the information. Click Retry to send the information again or click Cancel to return to the page that you were trying to view. And given the options of Retry or Cancel.

When I click Retry it will reload the calling page but doesn't close the popup window. Nethertheless, I need to bypass this message so the client doesn't get it everytime they select a value from the popup form. Any ideas how to reload a calling page from a popup window? Thanks!
 
Rather than a reload try just loading it again putting in your new values. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
How do I trigger this to happen? Closing down the popup window doesn't trigger an autopostback on the calling page. The calling page doesn't know that the popup window has been closed. I need to be able to know when the popup window has been closed so I can reload the calling page...
 
I am not to up on my javascript but instead of what you have couldn't you use.

Response.Write(&quot;<SCRIPT language='javascript'>&quot;)
Response.Write(&quot;window.opener.location='somelocation;&quot;)
Response.Write(&quot;self.close();&quot;)
Response.Write(&quot;</SCRIPT>&quot;)
That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Thanks I tried this, however this loads the page without a postback and therefore everything that the user selected on the calling page before opening the pop up window gets reset. Is there a way to do a postback of the calling page through the pop up form? Thanks!
 
Let's say I had a hidden form variable on the parent page called:

myVar

and I wanted to set this variable = 1 and then submit the parent page's form, and then close the popup. The javascript would be:

window.opener.document.forms[0].myVar.value = 1;
window.opener.document.forms[0].submit();
window.close();

hth! :)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top