Make sure that in your ASPX code that you include runat="server" in your
Hidden form field declaration, like this:
<input id="myHiddenField" type=hidden value="" runat="server">
Then declare it in the code-behind like this:
protected System.Web.UI.HtmlControls.HtmlInputHidden myHiddenField;
Then you can read the value like this (in code-behind):
string hiddenValue = myHiddenField.Value
or set the value like this (in code-behind):
myHiddenField.Value = "whatever";
And client-side you just refer to the hidden field like you normally would:
document.Form1.myHiddenField.value = "whatever";
-HTH
"xenophon" <xe******@online.nospam> wrote in message
news:7k********************************@4ax.com...
I add a Hidden form field to my asp.net page in the codebehind, the
Value peoperty is set to 0 and EnableViewState is set to true. Then I
add a LiteralControl with JavaScript that says to set the value to 1.
If I set view the value of th ehidden form field in the debugger
during the course of a PostBack, the value is still set to 0.
Are there any samples of setting a vlaue with JavaScript and reading
the new value in ASP.NET?
Thanks.