I'm trying to change a hidden field with javascript and then use that changed value in my codebehind. I have a breakpoint in Page_Load to check if the value of HiddenField1 has changed but it always remains 0 on postback.
<script type="text/javascript">
$(document).ready(function () {
var hiddenControl = '<%= HiddenField1.ClientID %>';
var s = $('#cbox');
$("#cbox").combobox({
selected: function (event, ui) {
alert(s.val());
document.getElementById(hiddenControl).value = s.val();
alert(document.getElementById(hiddenControl).value);
}
});
});
<asp:HiddenField ID="HiddenField1" runat="server" EnableViewState="False" Value="0" />
If I can't get this to work is there any other method to pass information between javascript and c# codebehind ?