[CLOSED] Hidden field value set in java script is empty in code behind page.

  1. #1

    [CLOSED] Hidden field value set in java script is empty in code behind page.

    Hi,

    I have a js function that creates some link and on clicking that link, it calls another js function where i set values for hidden fields . Then,
    i navigate to same page where I would like to access these hidden fields , set them as session variables and navigate to some other page.
    (basically, I am trying to avaoid query string..)

    App.Hidden1.value = somejavascriptvariable;
    App.Hidden2.value = somejsvariable2;
    .
    .
    .

    And then trying to
    window.location.href = "samepage.aspx"

    In the code behind, on the same page, I am trying to access those hidden fields (this.Hidden1.value) in page load...but they are empty..I debugged to check that hiddenfileds contain values in js.

    pls help me find a solution on how I can access the values correctly? Also, as an additional info,

    Thanks,
    Veda
    Last edited by Daniil; Aug 01, 2013 at 3:47 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hello!

    Please, check that you have form tag

    <form runat="server">
    ...
    </form>
    Can you say how you submit these values? Also, please, check that the request contains values from these fields.
    Last edited by Baidaly; Jul 26, 2013 at 9:31 PM.
  3. #3
    window.location.href = "samepage.aspx"
    It doesn't cause form submit, fields must be submitted
    Please see DirectEvents/DirectMethods or native ASP.NET postback to submit the form
    Vladimir Shcheglov
    Sr. Developer

Similar Threads

  1. [CLOSED] Access hidden field in code behind
    By PriceRightHTML5team in forum 2.x Premium Help
    Replies: 1
    Last Post: Jul 17, 2013, 3:27 PM
  2. [CLOSED] java script error
    By elke.schreiber in forum 2.x Premium Help
    Replies: 11
    Last Post: May 13, 2013, 2:19 PM
  3. Replies: 0
    Last Post: Jun 15, 2012, 11:49 AM
  4. Replies: 1
    Last Post: Mar 10, 2012, 3:58 PM
  5. [CLOSED] [1.0] Java Script broken under IE
    By tdracz in forum 1.x Premium Help
    Replies: 2
    Last Post: May 06, 2010, 4:46 PM

Posting Permissions