By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

Referencing an object in another browser instance. Possible?

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.