Referencing an object in another browser instance. Possible?

M

Martin

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
 
R

Rajiv R

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.
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top