472,119 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Referencing an object in another browser instance. Possible?

Hello Group

I'm having a bit of trouble figuring this out. I'm grateful for any
hints.

Let's assume I'm have a webapplication with two .aspx pages, Page A
and Page B.

Page A consists of a textbox (textbox1) and a HTML Button control.
Page B consists of a datagrid control.

When the button on Page A is clicked, Page B is opened in a new
browser window
displaying a list of values. (Page A stays open in the background)

When I select one of the values in Page B, I would like that the
textbox on Page A displays the value I selected.

It works if I save the value from Page B in a Session and then put a
server control button on Page A which updates the textbox once
clicked.
But how can I update the textbox directly from Page B? E.g. when
clicking on the datagrid run code like this:

Dim PageA as Page
PageA.textbox1.text = datagridvalue

It comes back as 'An object reference is not set to an instance of
this object.'

I've tried
PageA = CType(Context.Handler, PageA)
PageA.textbox1.text = datagridvalue
but I think it fails because Page B has been opened in a new browser
instance and was not called with the Server.Transfer method.

I also have made textbox1 Public to see whether that helps.

Please let me know whether it is possible to refer to textbox1 of Page
A in the background from Page B. If I save the value in a session and
switch to Page A and update the textbox with the session value it
works so there must be a way to do this directly on Page B??

One more theorie I have why it fails is that Page A has alredy been
rendered. But in this case I still could store the datagrid value in a
session and then have a script to refresh Page A with a statement in
the Page_Load event that assigns the session value to textbox1 if it's
not empty. Any hints how I can force Page A to reload from Page B?

Thanks for your efforts!

Martin
Nov 18 '05 #1
1 1247
Hi Martin,

client-side scripting in javascript will help you.

In pageB, you can access it parent page with the javascript object "opener".
So, handle onchange event of dropdown in PageB on the clientside and set the
value as opener.<FormNameInPageA>.<TextBoxName>.value.

Hope this helps.

--
Cheers!
Rajiv. R
Rajspace.Org

"Martin" <th************@hotmail.com> wrote in message
news:72**************************@posting.google.c om...
Hello Group

I'm having a bit of trouble figuring this out. I'm grateful for any
hints.

Let's assume I'm have a webapplication with two .aspx pages, Page A
and Page B.

Page A consists of a textbox (textbox1) and a HTML Button control.
Page B consists of a datagrid control.

When the button on Page A is clicked, Page B is opened in a new
browser window
displaying a list of values. (Page A stays open in the background)

When I select one of the values in Page B, I would like that the
textbox on Page A displays the value I selected.

It works if I save the value from Page B in a Session and then put a
server control button on Page A which updates the textbox once
clicked.
But how can I update the textbox directly from Page B? E.g. when
clicking on the datagrid run code like this:

Dim PageA as Page
PageA.textbox1.text = datagridvalue

It comes back as 'An object reference is not set to an instance of
this object.'

I've tried
PageA = CType(Context.Handler, PageA)
PageA.textbox1.text = datagridvalue
but I think it fails because Page B has been opened in a new browser
instance and was not called with the Server.Transfer method.

I also have made textbox1 Public to see whether that helps.

Please let me know whether it is possible to refer to textbox1 of Page
A in the background from Page B. If I save the value in a session and
switch to Page A and update the textbox with the session value it
works so there must be a way to do this directly on Page B??

One more theorie I have why it fails is that Page A has alredy been
rendered. But in this case I still could store the datagrid value in a
session and then have a script to refresh Page A with a statement in
the Page_Load event that assigns the session value to textbox1 if it's
not empty. Any hints how I can force Page A to reload from Page B?

Thanks for your efforts!

Martin

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Mark Broadbent | last post: by
15 posts views Thread by Carlos Lozano | last post: by
6 posts views Thread by martin | last post: by
3 posts views Thread by H. S. Lahman | 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.