How to assign value to Hidden Field using javascript?

By James J

Set Hidden Field value...

<input id="HiddenField1" type="hidden" />

<script type="text/JavaScript">
var str=”Hello”
document.getElementByID(“HiddenField1”).value=str
</script>


protected void Page_Load(object sender, EventArgs e)
{
    
string str=request["HiddenField1"].ToString();
}

How to assign value to Hidden Field using javascript?  (1222 Views)