473,320 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Window.Opener Creating A Refresh In Parent Window

I have created a ASP.NET application and created two forms within the
application (Webform1.aspx & Webform2.aspx). On the first form I have
placed a textbox (TextBox1) and a button, which when clicked opens the
second form using the window.open(). On the second form I have a textbox
(TextBox1) and a button as well. When the second button is clicked it
closes the second window with window.close(). What I need to happen is a
refresh to happen on the original form so that the value passed back from
the second window is displayed in the textbox.

Webform1 Button Click Event
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400,
menubar=no, resizable=no, top=200, left=200')" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

Webform2 Button Click Event

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.opener.document.forms(0).value=" & Chr(34) & TextBox1.Text & Chr(34)
& ";window.close();window.opener.location.href =
window.opener.location.href" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

I have tried various options but none seem to work. Can anyone advise?

Cheers

Steve


Nov 18 '05 #1
3 4313
On Sun, 29 Aug 2004 21:49:41 GMT, Steve Wark <st*******@contra-soft.com>
wrote:
I have created a ASP.NET application and created two forms within the
application (Webform1.aspx & Webform2.aspx). On the first form I have
placed a textbox (TextBox1) and a button, which when clicked opens the
second form using the window.open(). On the second form I have a textbox
(TextBox1) and a button as well. When the second button is clicked it
closes the second window with window.close(). What I need to happen is a
refresh to happen on the original form so that the value passed back from
the second window is displayed in the textbox.

Webform1 Button Click Event
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400,
menubar=no, resizable=no, top=200, left=200')" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

Webform2 Button Click Event

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.opener.document.forms(0).value=" & Chr(34) & TextBox1.Text &
Chr(34)
& ";window.close();window.opener.location.href =
window.opener.location.href" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

I have tried various options but none seem to work. Can anyone advise?

Cheers

Steve

you're closing the second window before refreshing the opener; closing the
window stops the script right there, so the next line never runs. Switch
those around, .close() is the last thing to do....

btw, why do you need a refresh immediately? You can put the value back
into the opener's textbox and not need to force a refresh....just FYI

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
I tired you suggestion but it did not work, can you point me to a code
snippet ?

Steve

"Craig Deelsnyder" <cdeelsny@no_spam_4_meyahoo.com> wrote in message
news:opsdilfyin75dg5d@g51y101...
On Sun, 29 Aug 2004 21:49:41 GMT, Steve Wark <st*******@contra-soft.com>
wrote:
I have created a ASP.NET application and created two forms within the
application (Webform1.aspx & Webform2.aspx). On the first form I have
placed a textbox (TextBox1) and a button, which when clicked opens the
second form using the window.open(). On the second form I have a textbox (TextBox1) and a button as well. When the second button is clicked it
closes the second window with window.close(). What I need to happen is a refresh to happen on the original form so that the value passed back from the second window is displayed in the textbox.

Webform1 Button Click Event
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400, menubar=no, resizable=no, top=200, left=200')" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

Webform2 Button Click Event

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.opener.document.forms(0).value=" & Chr(34) & TextBox1.Text &
Chr(34)
& ";window.close();window.opener.location.href =
window.opener.location.href" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

I have tried various options but none seem to work. Can anyone advise?

Cheers

Steve

you're closing the second window before refreshing the opener; closing the
window stops the script right there, so the next line never runs. Switch
those around, .close() is the last thing to do....

btw, why do you need a refresh immediately? You can put the value back
into the opener's textbox and not need to force a refresh....just FYI

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #3
you have a couple problems:

1) webform1 uses code that will not work with a popup blocker (say xp-sp2)
2) webform1 close itsself before doing anything
3) webform1 tries to update a textbox, but then forces a reload that will
replace this value with tthe server version

-- bruce (sqlwork.com)

"Steve Wark" <st*******@contra-soft.com> wrote in message
news:xh*****************@news-server.bigpond.net.au...
I tired you suggestion but it did not work, can you point me to a code
snippet ?

Steve

"Craig Deelsnyder" <cdeelsny@no_spam_4_meyahoo.com> wrote in message
news:opsdilfyin75dg5d@g51y101...
On Sun, 29 Aug 2004 21:49:41 GMT, Steve Wark <st*******@contra-soft.com>
wrote:
I have created a ASP.NET application and created two forms within the
application (Webform1.aspx & Webform2.aspx). On the first form I have
placed a textbox (TextBox1) and a button, which when clicked opens the
second form using the window.open(). On the second form I have a textbox (TextBox1) and a button as well. When the second button is clicked it
closes the second window with window.close(). What I need to happen is
a
refresh to happen on the original form so that the value passed back from the second window is displayed in the textbox.

Webform1 Button Click Event
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400, menubar=no, resizable=no, top=200, left=200')" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

Webform2 Button Click Event

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" &
"window.opener.document.forms(0).value=" & Chr(34) & TextBox1.Text &
Chr(34)
& ";window.close();window.opener.location.href =
window.opener.location.href" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

I have tried various options but none seem to work. Can anyone advise?
Cheers

Steve

you're closing the second window before refreshing the opener; closing

the window stops the script right there, so the next line never runs. Switch those around, .close() is the last thing to do....

btw, why do you need a refresh immediately? You can put the value back
into the opener's textbox and not need to force a refresh....just FYI

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: nadia | last post by:
Is it possible to do the following in php: I want to have a main form open. In the form I want a button that will open a popup window so the user can search for something. The user can then select...
1
by: Debbie Davis | last post by:
Hi there, I'm not very good at javascript but I'm using the following to close a child window and refresh a parent window after updating a database. It's within an ASP page. CODE <SCRIPT>...
5
by: Dave | last post by:
I see this problem in IE but not Firefox. I have a page that opens a second page as a dialog box. If the Dialog is relaunched from a second instance on the page the Dialog window is reused, the...
2
by: Raj | last post by:
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...
2
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for...
2
by: Ralf | last post by:
Using .NET 1.1, vb code behind. I have a project and I have been opening new windows throughout it. I need them opened on top of the parent, and be able to minimize or go back to the parent if...
2
by: carrajo | last post by:
Hello, What would be the correct javascript code to do the following: - Open a pop-up window ( a file called form.html. form.html post to a script ) - When form.html is submitted I would like...
4
by: minay111 | last post by:
Hello Experts, i've to open child window whose content type is "application/pdf"; Now i want to refresh the parent window after loading of the child window. My problem is that i can not write...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.