Say I have a view, strongly typed to MyObject, with an Html.HiddenFor(x => x.MyValue)
When I post the for back to the server, MyValue is bound properly with myObject.MyValue.
Now, say on the form I want to use jQuery to make a TextBox visible containing MyValue, allow the user to edit this, and post the new value back to the server.
How can I handle this? Should I just update the hidden field? Can I somehow specify which element to bind to on the client side?
you can update values of your hidden field in submit event of the form. Probably, you are displaying form values in labels (or spans or divs) when user is not in edit mode and user can toggle between edit and display mode. if you update your values only before the form is being submit you don’t have to bother about intermediate values user entered and cancelled out