generate popup for search, then populate parent window with selection

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Any suggestions on how to go about generating a popup, giving the user a way
of searching for something, and then taking their selection after closing
the pop-up and populating the parent form with the selection from the child?
I can do everything up until the point of having to populate the parent form
with the selection from the child form. How do I put the information back
into the parent so that the asp.net code in the parent can actually retrieve
what the user selected in the child?

JavaScript is the answer, but a snippet of code and/or a link to an example
would be great! Thanks in advance.

Mark
 
Mark,

The easiest way to do this is to send the information back to the original
window in the query string. You may use a javascript window.open command to
"re-open" the original window. The trick to making the javascript re-use the
original window is to name the original window and then target that window
name with the window.open command.

So:

Place a javascript in your original page like this:

<script language="JavaScript">
<!-- Begin
name='first';
// End -->
</script>

Then in your popup when you call the orignal page:

<script language="JavaScript">
<!-- Begin
window.open('FirstPage.aspx?info=[your querystring info
here...]&moreinfo=[more querystring info here...]', 'first')

window.close()

// End -->
<script language="JavaScript">


Since the javascript in the popup opens a window named: "first" it
automatically re-uses the already opened "first" window, then closes itself.

Hope this helps!

If you have any questions let me know.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Query string - great idea. Thanks Justin!

Mark

S. Justin Gengo said:
Mark,

The easiest way to do this is to send the information back to the original
window in the query string. You may use a javascript window.open command to
"re-open" the original window. The trick to making the javascript re-use the
original window is to name the original window and then target that window
name with the window.open command.

So:

Place a javascript in your original page like this:

<script language="JavaScript">
<!-- Begin
name='first';
// End -->
</script>

Then in your popup when you call the orignal page:

<script language="JavaScript">
<!-- Begin
window.open('FirstPage.aspx?info=[your querystring info
here...]&moreinfo=[more querystring info here...]', 'first')

window.close()

// End -->
<script language="JavaScript">


Since the javascript in the popup opens a window named: "first" it
automatically re-uses the already opened "first" window, then closes itself.

Hope this helps!

If you have any questions let me know.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche


Mark said:
Any suggestions on how to go about generating a popup, giving the user a way
of searching for something, and then taking their selection after closing
the pop-up and populating the parent form with the selection from the child?
I can do everything up until the point of having to populate the parent form
with the selection from the child form. How do I put the information back
into the parent so that the asp.net code in the parent can actually retrieve
what the user selected in the child?

JavaScript is the answer, but a snippet of code and/or a link to an example
would be great! Thanks in advance.

Mark
 
Back
Top