When I use a form html helper method in one of my views like <%=Html.Hidden("id", "some id text") %>
it creates a hidden input field for me but it puts the wrong value in there.
Instead of getting
<input name="id" type="hidden" value="some id text"/>
I get
<input name="id" type="hidden" value="11000"/>
So the value is being found from somewhere else. In this case it's the primary id of the parent record. So it is an id, it's just the wrong id.
Does anyone have any ideas? I'm pretty sure this didn't happen in MVC1
Model binding always takes precedence. The model binder doesn't know of if a field is hidden. See http://forums.asp.net/t/1559541.aspx and http://forums.asp.net/t/1703334.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With