Moving value from popup Webform to main Webform?

G

Guest

How can I transfer some text from a Textbox in a popup window to the main
webform that opened that popup?
The popup webform will have some type of Button that the user will click in
order to accept those changes. This is where the transter of the value should
be. It could also be done when I close the popup form (whichever is easier).
Once the popup form is closed, the value will then be used to fill a textbox
in the main Form.
I use VS2005 v2.0.

Thanks.
 
G

GroupReader

1. pass a text box name (client-side name) from the main form to the
popup form (in the url).
2. the popup form gets a reference to it's "opener." Search for
window.opener in google. Note: getting a reference to the opener
could vary depending on browser type and the way the window is opened.
See also showModalDialog.

Example:
<script type="text/javascript">
var OpenerWindow = window.opener; // for when using window.open
if (OpenerWindow == null) {
OpenerWindow = window.dialogArguments; // for when using
window.openModalDialog
}
</script>

3. the popup form sets the text box in the parent form to a value
window.opener.textboxname.value = 'hello';
a) You can build this string dynamically in the code-behind - string
together the command with the proper text box name.
b) You can build this string dynamically in javascript using the
javascript eval( ) command: eval( 'window.opener.' + textboxname +
'.value') = 'hello'. Not sure on the syntax here, but it's something
like that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top