Imagine you have sent a model to a view... You are attempting to save this model once you edit it. If you don't write out all of the fields (that identity the object for instance), somehow they get reset to zero or empty (if it is string). What I did though, was write out a hidden field so that when I attempt to save this object, I am able to identify which object it is...
Is this good form? Or am I missing a step?
If you've specified your model type to the view on the header of the file, and you are using the
Html.BeginForm
helper method, I'm pretty sure it will already take care of sending the id for you.Edit: I tested it, and it's right. The Html.BeginForm method created the output
That's why it sends the id.
Here's the Controller I used to test it:
and the View: