100
rated 0 times
[
101]
[
1]
/ answers: 1 / hits: 15512
/ 15 Years ago, fri, september 18, 2009, 12:00:00
I'm trying to use the value of an asp:HiddenField control in javascript after postback and pageload.I tried something like this but it does not work.(the get function works fine but I cant seem to make hidVal get the value from the asp:HiddenFIeld)
<script type=text/javascript language=javascript>
var hidVal=document.getElementById(<% =hidField.ClientID %>).value;
function Get(checbox)
{
if(checbox.checked)hidVal += 1;
else hidVal -= 1;
document.getElementById(<% =hidField.ClientID %>).value = hidVal.toString();
}
Basicly I'm trying to get the value of a hidden field , increment it on every checked checkbox(using javascript) and reasign the incremented value to the hidden field on every postback.
If you have any idea on how to make this work please help.
Thanks for the time.
More From » asp.net