|
 |
aspx thread: Exchange data between opened browser windows
Message #1 by mudar@e... on Wed, 8 May 2002 20:30:47
|
|
I want to make a search page that returns the selected item to another
opened page.
Something like when retreiving an email address from the address book
page, and displaying it in the "To" text box.
Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Wed, 8 May 2002 15:33:22 -0400
|
|
You'll have to do some client-side JavaScript to accomplish this.
Basically you have a link like...
<a href="addressbook.aspx" target="_new">Address Book</a>
<!-- target="_new" means open in a new browser window - you can get better
control with the window.open() JavaScript method -->
and they essentially select a name from the address book (by highlighting a
name in a <select> list box, let's say), then click on "OK", the OK button
would look like:
<input type="button" text="OK" onClick="parent.document.yourForm.To.value
document.bookForm.email.value; window.close();" />
Note this is all done client-side, not server side (except the
request for the Address Book page, of course).
HTH,
- Chuck
-----Original Message-----
From: mudar@e... [mailto:mudar@e...]
Sent: Wednesday, May 08, 2002 4:31 PM
To: ASP+
Subject: [aspx] Exchange data between opened browser windows
I want to make a search page that returns the selected item to another
opened page.
Something like when retreiving an email address from the address book
page, and displaying it in the "To" text box.
Message #3 by "Albert Davis" <albertdavis@h...> on Wed, 08 May 2002 15:39:27 -0400
|
|
Isn't parent.document giving you reference if you were in a child IFrame or
such trying to gain reference to the parent doc? Shouldn't if you have
opened a child window and that child window is trying to gain a pointer
reference to the parent window you use "window.opener.document..."...
Just curious...
>From: Feduke Cntr Charles R <FedukeCR@m...>
>Reply-To: "ASP+" <aspx@p...>
>To: "ASP+" <aspx@p...>
>Subject: [aspx] RE: Exchange data between opened browser windows
>Date: Wed, 8 May 2002 15:33:22 -0400
>
> You'll have to do some client-side JavaScript to accomplish this.
>Basically you have a link like...
>
><a href="addressbook.aspx" target="_new">Address Book</a>
><!-- target="_new" means open in a new browser window - you can get better
>control with the window.open() JavaScript method -->
>
>and they essentially select a name from the address book (by highlighting a
>name in a <select> list box, let's say), then click on "OK", the OK button
>would look like:
>
><input type="button" text="OK" onClick="parent.document.yourForm.To.value
>document.bookForm.email.value; window.close();" />
>
> Note this is all done client-side, not server side (except the
>request for the Address Book page, of course).
>
>HTH,
>- Chuck
>
>-----Original Message-----
>From: mudar@e... [mailto:mudar@e...]
>Sent: Wednesday, May 08, 2002 4:31 PM
>To: ASP+
>Subject: [aspx] Exchange data between opened browser windows
>
>
>
>I want to make a search page that returns the selected item to another
>opened page.
>
>Something like when retreiving an email address from the address book
>page, and displaying it in the "To" text box.
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
Message #4 by Mindy Leslie <mindyjeanne@y...> on Wed, 8 May 2002 13:19:46 -0700 (PDT)
|
|
--0-791154509-1020889186=:95139
Content-Type: text/plain; charset=us-ascii
The only way I've figured out how to do this in ASP.NET is using javascript.
From the original page, have a javascript client-side function open a window.
In the new window, write a javascript function which is called during the onload
procedure set up in your Body tag.
In the following example. DRSystem, is my form defined in the Opener Form, DiaryDate is the field that needs updating.
As far as dateToSet, that is a hidden field that upon initial page load, is set to NotSet.
( I do this, so that on the initial loading of the page, this function will do nothing )
WriteToOpener_onload()
{
var dateToSet = document.DateForm.DateSet;
if( dateToSet.value != "NotSet" ){ //alert( dateToSet.value );
window.opener.document.DRSystem.DiaryDate.value= dateToSet.value;
self.close();
/*
this is to close the window once the date has been set.
*/
}
}
In the Code Behind, function for clicking on the value you want set ( in this case, it is a calendar control ), I reset dateToSet to
the value I want placed in DiaryDate. Wala.
private void Calendar1_SelectionChanged(object sender, System.EventArgs e)
{
string todaysDate = Calendar1.SelectedDate.ToString();
/*
badly named variable...todaysdate represents the date/time of the selection I clicked on
i chop at the space, since I don't need the time.
*/
DateSet.Value = todaysDate.Substring( 0, todaysDate.IndexOf(" " ) );
}
If you are not using ASP.NET, but ASP.
You don't need to do this as a onload() event. You can just create an OnClick event that
calls a javascript function. You also don't need the hidden value.
I hope this makes sense.
If anyone else knows a better way, please let me know. Also, is there a way to do add an attribute to the body tag. It would
simplify the above code.
Mindy Jeanne
mudar@e... wrote:
I want to make a search page that returns the selected item to another
opened page.
Something like when retreiving an email address from the address book
page, and displaying it in the "To" text box.
---------------------------------
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
Message #5 by Feduke Cntr Charles R <FedukeCR@m...> on Thu, 9 May 2002 08:36:53 -0400
|
|
> opened a child window and that child window is trying to gain a pointer
> reference to the parent window you use "window.opener.document..."...
Yeah, you're right. You also just saved me about an hour of
debugging when parent.document didn't work for me, as I'm about to code
something along those lines. Thanks!
- Chuck
-----Original Message-----
From: Albert Davis [mailto:albertdavis@h...]
Sent: Wednesday, May 08, 2002 3:39 PM
To: ASP+
Subject: [aspx] RE: Exchange data between opened browser windows
Isn't parent.document giving you reference if you were in a child IFrame or
such trying to gain reference to the parent doc? Shouldn't if you have
opened a child window and that child window is trying to gain a pointer
reference to the parent window you use "window.opener.document..."...
Just curious...
>From: Feduke Cntr Charles R <FedukeCR@m...>
>Reply-To: "ASP+" <aspx@p...>
>To: "ASP+" <aspx@p...>
>Subject: [aspx] RE: Exchange data between opened browser windows
>Date: Wed, 8 May 2002 15:33:22 -0400
>
> You'll have to do some client-side JavaScript to accomplish this.
>Basically you have a link like...
>
><a href="addressbook.aspx" target="_new">Address Book</a>
><!-- target="_new" means open in a new browser window - you can get better
>control with the window.open() JavaScript method -->
>
>and they essentially select a name from the address book (by highlighting a
>name in a <select> list box, let's say), then click on "OK", the OK button
>would look like:
>
><input type="button" text="OK" onClick="parent.document.yourForm.To.value
>document.bookForm.email.value; window.close();" />
>
> Note this is all done client-side, not server side (except the
>request for the Address Book page, of course).
>
>HTH,
>- Chuck
>
>-----Original Message-----
>From: mudar@e... [mailto:mudar@e...]
>Sent: Wednesday, May 08, 2002 4:31 PM
>To: ASP+
>Subject: [aspx] Exchange data between opened browser windows
>
>
>
>I want to make a search page that returns the selected item to another
>opened page.
>
>Something like when retreiving an email address from the address book
>page, and displaying it in the "To" text box.
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
|
|
 |