Open new window, passing values

A

Aaron

I am having a little difficulty with a relatively simple task.
I have a parent webform. I have a javascript attribute added to a button to
open a new window when clicked.
The user fills in a textbox then clicks the button and on page load the
child window should grab that val run a query an present the results.

Given that I am bouncing between server side controls and client script. I
am just having a little trouble passing my textbox value over to the popup.
Any help would be appreciated.
 
G

Guest

Option 1 is to use a query string
string TextBox1= document.getElementById('ParentTextBoxname');
Window.open ("popup.aspx?text=" + TextBox1.value)

if query string doesnt work for you, Option 2 is to access the textbox
directly from parent.. but the popup page will need to grab this value and
postback to itself to run the query. (assuming there are no frames in parent
page) following is the javascript to access the textbox in parent window

window.parent.document.forms[0].ParentTextBoxname.value;
 
A

Aaron

Maybe I should clarify. I think I have that portion working but I need to
send values not only to the popup but back to the parent. And I have met the
second problem with limited success.


Sreejith Ram said:
Option 1 is to use a query string
string TextBox1= document.getElementById('ParentTextBoxname');
Window.open ("popup.aspx?text=" + TextBox1.value)

if query string doesnt work for you, Option 2 is to access the textbox
directly from parent.. but the popup page will need to grab this value and
postback to itself to run the query. (assuming there are no frames in
parent
page) following is the javascript to access the textbox in parent window

window.parent.document.forms[0].ParentTextBoxname.value;


Aaron said:
I am having a little difficulty with a relatively simple task.
I have a parent webform. I have a javascript attribute added to a button
to
open a new window when clicked.
The user fills in a textbox then clicks the button and on page load the
child window should grab that val run a query an present the results.

Given that I am bouncing between server side controls and client script.
I
am just having a little trouble passing my textbox value over to the
popup.
Any help would be appreciated.
 
G

Guest

From popup (client side javascript) , you can access a control in parent page
with following syntax (if the popup was opened with window.open)

window.opener.document.getElementById("TextBox1").value = 'string from popup';


Aaron said:
Maybe I should clarify. I think I have that portion working but I need to
send values not only to the popup but back to the parent. And I have met the
second problem with limited success.


Sreejith Ram said:
Option 1 is to use a query string
string TextBox1= document.getElementById('ParentTextBoxname');
Window.open ("popup.aspx?text=" + TextBox1.value)

if query string doesnt work for you, Option 2 is to access the textbox
directly from parent.. but the popup page will need to grab this value and
postback to itself to run the query. (assuming there are no frames in
parent
page) following is the javascript to access the textbox in parent window

window.parent.document.forms[0].ParentTextBoxname.value;


Aaron said:
I am having a little difficulty with a relatively simple task.
I have a parent webform. I have a javascript attribute added to a button
to
open a new window when clicked.
The user fills in a textbox then clicks the button and on page load the
child window should grab that val run a query an present the results.

Given that I am bouncing between server side controls and client script.
I
am just having a little trouble passing my textbox value over to the
popup.
Any help would be appreciated.
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top