G
Guadala Harry
In an aspx file I have declared a hidden field like this:
<input id="hTestVal" type=hidden value="-1" runat="server">
Defined in the code-behind like this:
protected System.Web.UI.HtmlControls.HtmlInputHidden hTestVal;
In client-side JavaScript I set the value like this:
document.all("hTestVal").Value = "yo";
The problem is that the value of the hidden field (hTestVal) does not get
updated (It is not updated on Postback, and when I view the source of the
rendered aspx page in IE6, the value is still "-1" even though the
client-side script has executed (to set the value to "yo").
I believe the value is in fact getting updated in the client, because the
following line, when executed immediately after setting the value to "yo"
produces the/that new value:
alert(document.all("hTestVal").Value);
FWIW, the hidden control is declared within a form, like this:
<form id="Form1" method="post" runat="server">
I'm confused because I have a virtually identical setup in other pages in my
site and those hidden fields and client-side value changes work just fine...
meaning that the value set in the client-side script shows up in the control
on the server during postback as expected.
What could be the deal? I need to receive the updated value (e.g., "yo") in
the server on postback.
Thanks
<input id="hTestVal" type=hidden value="-1" runat="server">
Defined in the code-behind like this:
protected System.Web.UI.HtmlControls.HtmlInputHidden hTestVal;
In client-side JavaScript I set the value like this:
document.all("hTestVal").Value = "yo";
The problem is that the value of the hidden field (hTestVal) does not get
updated (It is not updated on Postback, and when I view the source of the
rendered aspx page in IE6, the value is still "-1" even though the
client-side script has executed (to set the value to "yo").
I believe the value is in fact getting updated in the client, because the
following line, when executed immediately after setting the value to "yo"
produces the/that new value:
alert(document.all("hTestVal").Value);
FWIW, the hidden control is declared within a form, like this:
<form id="Form1" method="post" runat="server">
I'm confused because I have a virtually identical setup in other pages in my
site and those hidden fields and client-side value changes work just fine...
meaning that the value set in the client-side script shows up in the control
on the server during postback as expected.
What could be the deal? I need to receive the updated value (e.g., "yo") in
the server on postback.
Thanks