Avatar of dshi15
dshi15Flag for United States of America asked on

how to close a window (the page cannot be refreshed without resending the information)

Hi Expert,

I opened window for update record, the following code in new window aspx.vb page
Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
'update database table here
Response.Write("<script language='javascript'> { opener.location.reload(true); self.close() }</script>")
end sub

Window can close with no problem, but before it close it has

the page cannot be refreshed without resending the information.Click Retry to send the finformation again, or click Cancel to return to the page that you were trying to view.

How I can let it go away?

JavaScriptASP.NET

Avatar of undefined
Last Comment
dshi15

8/22/2022 - Mon
SOLUTION
margajet24

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
margajet24

if you intended to send an information without reloading the page, you can use AJAX.

use AJAX before you close it..
ASKER
dshi15

I intentionally included reload(), because I like the original page show updated record.
third

instead of reloading the opener through the reload function, try


opener.location.href = 'youropenerURLhere.aspx';
self.close()
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
dshi15

I tried remove opener.location.reload(true);    
Now window can close, but open page still show original record.

For example, I have page in browser.

First name  Last name

James           hucks                         Edit Button

user click on Edit Button, new window open, user changed 'James' to 'Jamie', after  widow.close, I want  original window show  

First name  Last name

Jamie           hucks                         Edit Button
ASKER
dshi15

when I load original page I have several variables passed, for example,

'youropenerURLhere.aspx?Lastname=hucks'

So I need pass the variable again?


third

if these parameters are not required on displaying your required information on the page, then there's no need to includes these items. most likely you will only include a record identifier say an ID or something.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
third

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
dshi15

for example  

First name  Last name

James           hucks                         Edit Button
Mary             hucks                         Edit Button

after update first record, the page will be

Jamie            hucks                         Edit Button
Mary             hucks                         Edit Button

So I need write
'youropenerURLhere.aspx?Lastname=' & session("lastname") ,
self.close()
then page can reload and requery database, is that right?


third

yes that is correct.

but to me if the value you are passing is already in a session, then there's no point of getting it through the querystring. you can assign the session variable value directly in your page instead.
ASKER
dshi15

I tried this one, it is works
opener.location = opener.location.href;

Thanks.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck