Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Window.Opener Creating A Refresh In Parent Window

Reply
Thread Tools

Window.Opener Creating A Refresh In Parent Window

 
 
Steve Wark
Guest
Posts: n/a
 
      08-29-2004
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




 
Reply With Quote
 
 
 
 
Craig Deelsnyder
Guest
Posts: n/a
 
      08-29-2004
On Sun, 29 Aug 2004 21:49:41 GMT, Steve Wark <(E-Mail Removed)>
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
 
Reply With Quote
 
 
 
 
Steve Wark
Guest
Posts: n/a
 
      08-30-2004
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
newspsdilfyin75dg5d@g51y101...
> On Sun, 29 Aug 2004 21:49:41 GMT, Steve Wark <(E-Mail Removed)>
> 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



 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      10-28-2004
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" <(E-Mail Removed)> wrote in message
newshMYc.13572$(E-Mail Removed)...
> 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
> newspsdilfyin75dg5d@g51y101...
> > On Sun, 29 Aug 2004 21:49:41 GMT, Steve Wark <(E-Mail Removed)>
> > 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

>
>



 
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
Refresh Parent window from child window causes problems Raj ASP .Net 3 06-11-2009 05:58 AM
clicking on a thumbnail in a parent window causes parent to reload PWalker Javascript 1 02-24-2005 12:56 PM
Getting a page to refresh the parent, even when not loaded from the parent? Bill S. Javascript 2 05-08-2004 04:56 AM
Close pop window and refresh the parent window J P Singh ASP General 3 02-11-2004 01:59 AM



Advertisments