472,143 Members | 1,301 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

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
3 3952
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
1 post views Thread by laxmi | last post: by
29 posts views Thread by wayne | last post: by
2 posts views Thread by Alessandro Rossi | last post: by
2 posts views Thread by RJN | last post: by
4 posts views Thread by Bob Bedford | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.