Input hidden control doesn´t keep the his value between postbacks

fernandohawk

New Member
I'm making an webpage using ASP.NET MVC.I have the following input hidden definied:\[code\]<%=Html.Hidden("inputHiddenSelectedMenuId") %>\[/code\]And i set its value in this js function:\[code\]function SetSelectedMenu(id) { $('#inputHiddenSelectedMenuId').val(id); }\[/code\]After a make a postback in the js init function i want to use the value set in the input hidden but the value is string empty.\[code\]$(document).ready(function() { $('div.nav > a').removeClass('active'); var id = $('#inputHiddenSelectedMenuId').val(); if (id != "") { $("#" + id).addClass('active'); } });\[/code\]Can anyone give a hint why this is happening?Thanks in advanced
 
Top