How to get HtmlInputHidden value in a popup window?

Discussion in 'ASP .Net' started by Jack, Nov 28, 2005.

  1. Jack

    Jack Guest

    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;
     
    Jack, Nov 28, 2005
    #1
    1. Advertising

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

    "Jack" <> wrote in message
    news:...
    > 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;
    >
     
    Peter Rilling, Nov 28, 2005
    #2
    1. Advertising

  3. Jack

    Jack Guest

    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".
     
    Jack, Nov 28, 2005
    #3
  4. 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" <> wrote in message
    news:...
    >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".
    >
     
    Peter Rilling, Nov 28, 2005
    #4
  5. Jack

    Jack Guest

    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.
     
    Jack, Nov 30, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jiho Han
    Replies:
    2
    Views:
    1,920
    Jiho Han
    Feb 11, 2004
  2. Julius Fenata

    HtmlInputHidden Control

    Julius Fenata, Jan 18, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    434
    Julius Fenata
    Jan 18, 2005
  3. Replies:
    6
    Views:
    1,944
  4. Scott
    Replies:
    1
    Views:
    589
    Scott
    Nov 26, 2004
  5. Raffi
    Replies:
    4
    Views:
    231
    Dr John Stockton
    Aug 12, 2004
Loading...

Share This Page