467,188 Members | 1,449 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,188 developers. It's quick & easy.

Open new window, passing values

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.
Nov 19 '05 #1
  • viewed: 3741
Share:
3 Replies
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" wrote:
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.

Nov 19 '05 #2
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" <Sr*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
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" wrote:
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.

Nov 19 '05 #3
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" wrote:
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" <Sr*********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
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" wrote:
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.


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by lukeo | last post: by
2 posts views Thread by Alessandro Rossi | last post: by
2 posts views Thread by RJN | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.