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 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
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
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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>...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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
|
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...
|
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...
| |