I have a viewModel that has a field called COESNo..
when I try to write it in the view like so
@Html.HiddenFor(m=>m.COESNo)
and then try to access it later using Jquery $("#COESNo).val() it says it is empty
but if I do the following
<input type="hidden" id="COESNo" value="@Model.COESNo" />
I can get the value from Jquery.. why is it setting the value to empty when I use the hiddenfor?
Thanks
Ok, so finally worked out what the issue was. The request was a Get request and there was a query string value called 'COESNo'. This seem to confuse the Hiddenfor. I changed the variable name to COESValue and it works a treat. Is it trying to model bind in the razor view?