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

How to get HtmlInputHidden value in a popup window?

P: n/a
In page1:<INPUT id="MD" type="hidden" name="MD" value="Hello world">,
and there is a button, has a javascript onclick event, in this event, a
popup window will appear.

In the pop-up window, how can I get the hidden control's value (Hello
world) in code behind?
BTW, I can get it in clicent by:
var MDValue = window.opener.document.getElementById("MD").value;

Nov 28 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You have to pass that as a querystring parameter to the popup, then the
code-behind can access it.

"Jack" <ls*****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
In page1:<INPUT id="MD" type="hidden" name="MD" value="Hello world">,
and there is a button, has a javascript onclick event, in this event, a
popup window will appear.

In the pop-up window, how can I get the hidden control's value (Hello
world) in code behind?
BTW, I can get it in clicent by:
var MDValue = window.opener.document.getElementById("MD").value;

Nov 28 '05 #2

P: n/a
I know I can access via querystring, but what I need is:
The page can only be opened in my way, never display information if
user input the link in the addressbar, then click "enter".

Nov 28 '05 #3

P: n/a
For the popup to be the information, the accepted way is to use the
querystring. A popup is nothing more than a page, and there is little you
can do to prevent the user from loading it manually.

Now, if you want to be tricky, you could always do a postback for your
button and then use something like RegisterStartupScript to inject the
showModelDialog function. This way you can store the field value in a
session variable and use this to verify they came from the correct place.
You can also check the Referer header field to make sure they came from your
page.

"Jack" <ls*****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I know I can access via querystring, but what I need is:
The page can only be opened in my way, never display information if
user input the link in the addressbar, then click "enter".

Nov 28 '05 #4

P: n/a
The 2 sites are different, Session doesn't work in this case.
I'm using javascript to control it,
if( window.opener == null )
// window.location = "xxxx";

but it isn't safe anyway.

Nov 30 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.