Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Refresh Parent window from child window causes problems

Reply
Thread Tools

Refresh Parent window from child window causes problems

 
 
Raj
Guest
Posts: n/a
 
      06-30-2003
Hi All,
I have a problem with trying to refresh the parent window from
child window in order to update data in the parent window.

The sequence of events are
1) I click a button in the parent window to open a child window thru
javascript
window.open

2) I have some functionality in the child window that changes the data
in the parent window.

3) I need to refresh the parent window on child window closing

I read some posts here and I did window.opener.location.reload(true)
and window.opener.reload(true). when I did this, IE came up saying
"This page cannot be refreshed without resending information, Click
retry to send the information again ...." and all that crap when I hit
this the page is refreshed, but the ItemCommand of the parent window
had the same event that opened the child window and it opened it
again.

So even when I close it, I end up with the same window again.

Can someone please help me to refresh my parent window without this
message box and I dont want to have the child window open again

TIA
Raj
 
Reply With Quote
 
 
 
 
Axel Dahmen
Guest
Posts: n/a
 
      06-30-2003
Hmmm, to me it seems quite obvious that the Refresh function re-opens your child window. This was exactly what happened when you loaded your page the last time - and Refresh just repeats this loading process.

I'd set the parent window to a new location in order to have it "forget" its current state. Either by setting it to "opener.location=opener.location;" or if this doesn't work "opener.location=null; opener.location=opener.location;" or something.

HTH,
Axel Dahmen

------------------------------
"Raj" <(E-Mail Removed)> schrieb im Newsbeitrag news:(E-Mail Removed) om...
> Hi All,
> I have a problem with trying to refresh the parent window from
> child window in order to update data in the parent window.
>
> The sequence of events are
> 1) I click a button in the parent window to open a child window thru
> javascript
> window.open
>
> 2) I have some functionality in the child window that changes the data
> in the parent window.
>
> 3) I need to refresh the parent window on child window closing
>
> I read some posts here and I did window.opener.location.reload(true)
> and window.opener.reload(true). when I did this, IE came up saying
> "This page cannot be refreshed without resending information, Click
> retry to send the information again ...." and all that crap when I hit
> this the page is refreshed, but the ItemCommand of the parent window
> had the same event that opened the child window and it opened it
> again.
>
> So even when I close it, I end up with the same window again.
>
> Can someone please help me to refresh my parent window without this
> message box and I dont want to have the child window open again
>
> TIA
> Raj


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      06-30-2003
The problem lies in the way that WebForms work (POSTing back to themselves),
and the way the browser works. When a browser tries to refresh a page that
is the result of a form submission, it is necessary to re-submit the form,
as the form was generated as a result of a previous POST request.

Your only solution is to not refresh the browser in the parent window, but
to send a fresh GET request for the page, as if hyperlinked (as in
"parent.location = 'someURL'"). This may be problematic, as you probably
want to retain the state of the page as it presently exists, and a fresh
request for the page will return it in its' initial state. A workaround for
this would be to append a QueryString to the request, so that the
server-side class can read the QueryString in order to update itself to the
proper state. Another workaround would be to re-post the parent form (as in
"parent.forms[0].submit()"). Again, you would have to make sure that the
parent page could restore itself to its' correct state based upon the
results of the post.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.

"Raj" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi All,
> I have a problem with trying to refresh the parent window from
> child window in order to update data in the parent window.
>
> The sequence of events are
> 1) I click a button in the parent window to open a child window thru
> javascript
> window.open
>
> 2) I have some functionality in the child window that changes the data
> in the parent window.
>
> 3) I need to refresh the parent window on child window closing
>
> I read some posts here and I did window.opener.location.reload(true)
> and window.opener.reload(true). when I did this, IE came up saying
> "This page cannot be refreshed without resending information, Click
> retry to send the information again ...." and all that crap when I hit
> this the page is refreshed, but the ItemCommand of the parent window
> had the same event that opened the child window and it opened it
> again.
>
> So even when I close it, I end up with the same window again.
>
> Can someone please help me to refresh my parent window without this
> message box and I dont want to have the child window open again
>
> TIA
> Raj



 
Reply With Quote
 
gautamkhosla29 gautamkhosla29 is offline
Junior Member
Join Date: Jun 2009
Posts: 1
 
      06-11-2009
Hi,

Do try the following. It would work.

"window.opener.document.<formName of parent>.submit();
window.close();"

example: window.opener.document.f1.submit();
where f1 is the name of the form of parent window.

Your child window will be closed and parent window will be refreshed.

Enjoy!!

Gautam Khosla
Software Engineer
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a class Child inherits from Parent, how to implementChild.some_method if Parent.some_method() returns Parent instance ? metal Python 8 10-30-2009 10:31 AM
clicking on a thumbnail in a parent window causes parent to reload PWalker Javascript 1 02-24-2005 12:56 PM
Results from child window submit into parent window, then child closes -- How To? Spammay Blockay Javascript 1 02-04-2005 12:47 PM
Pass from parent to child, then update parent with child value... Noel Dolan Javascript 0 07-18-2004 05:52 PM
Re: Refresh of parent window from pop up child causes a problem Natty Gur ASP .Net 0 07-01-2003 06:08 AM



Advertisments