How to grant value to a html form hidden field

Discussion in 'ASP .Net' started by David Jia, Oct 16, 2006.

  1. David Jia

    David Jia Guest

    I have a html form in aspx pages, so how can I grant value to the hidden
    field in this form?

    For Example:

    <body>
    <script language="C#" runat="server">

    string strTest = "test";
    </script>

    <form name="try" action="post" >
    <input name="test1" type="hidden" />
    </form>

    How to make test1's value equals to strTest in C# script. Thank you very
    much
     
    David Jia, Oct 16, 2006
    #1
    1. Advertising

  2. that's not dot net :)

    this is:


    <script language="C#" runat="server">
    string strTest = "test";

    void Page_Load()
    {
    myHiddenField.value = strTest;
    }
    </script>

    <body>
    <form id="try" runat="server" >
    <asp:hiddenfield runat="server" id="myHiddenField" />
    </form>
    </body>

    --

    Bruno Alexandre
    København, Danmark

    "a Portuguese in Denmark"

    Blog. http://balexandre.blogspot.com/
    Photos. http://www.flickr.com/photos/balexandre/


    "David Jia" <> wrote in message
    news:%...
    >I have a html form in aspx pages, so how can I grant value to the hidden
    >field in this form?
    >
    > For Example:
    >
    > <body>
    > <script language="C#" runat="server">
    >
    > string strTest = "test";
    > </script>
    >
    > <form name="try" action="post" >
    > <input name="test1" type="hidden" />
    > </form>
    >
    > How to make test1's value equals to strTest in C# script. Thank you very
    > much
    >
     
    Bruno Alexandre, Oct 16, 2006
    #2
    1. Advertising

  3. David Jia

    Mark Rae Guest

    "David Jia" <> wrote in message
    news:%...

    David,

    Ignore Bruno's reply...

    > How to make test1's value equals to strTest in C# script. Thank you very
    > much


    <input name="test1" type="hidden" value="<%=strTest%>" />
     
    Mark Rae, Oct 16, 2006
    #3
  4. or

    ClientScript.RegisterHiddenField(name,value);

    -- bruce (sqlwork.com)

    "Mark Rae" <> wrote in message
    news:ub8%...
    > "David Jia" <> wrote in message
    > news:%...
    >
    > David,
    >
    > Ignore Bruno's reply...
    >
    >> How to make test1's value equals to strTest in C# script. Thank you very
    >> much

    >
    > <input name="test1" type="hidden" value="<%=strTest%>" />
    >
     
    bruce barker \(sqlwork.com\), Oct 16, 2006
    #4
  5. David Jia

    David Jia Guest

    Thank you , the solution you offered works well, thanks a lot to you
    again.!!
    "Mark Rae" <> дÈëÏûÏ¢ÐÂÎÅ:ub8%...
    > "David Jia" <> wrote in message
    > news:%...
    >
    > David,
    >
    > Ignore Bruno's reply...
    >
    >> How to make test1's value equals to strTest in C# script. Thank you very
    >> much

    >
    > <input name="test1" type="hidden" value="<%=strTest%>" />
    >
     
    David Jia, Oct 16, 2006
    #5
  6. David Jia

    Mark Rae Guest

    "David Jia" <> wrote in message
    news:O$...

    > Thank you , the solution you offered works well, thanks a lot to you
    > again.!!


    Welcome.
     
    Mark Rae, Oct 16, 2006
    #6
    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. xenophon

    Hidden Form Field Value Get?

    xenophon, Dec 9, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    28,633
  2. xenophon
    Replies:
    2
    Views:
    965
    Steven Cheng[MSFT]
    Dec 21, 2005
  3. Rick
    Replies:
    3
    Views:
    8,199
    Alexey Smirnov
    Apr 13, 2010
  4. GavMc
    Replies:
    4
    Views:
    342
    Evertjan.
    Sep 22, 2005
  5. Replies:
    6
    Views:
    209
Loading...

Share This Page