title: Id is not posted in ASP.NET MVC
body: <p>When I post my model, the Id is missing : </p>
  
  <p>I have an NHibernate database model "Contact" :</p>
  
  <pre><code>       public class Contact : Entity&lt;int&gt;
          {
              public virtual string LastName { get; set; }
              public virtual string FirstName { get; set; }
          }
  
          public abstract class Entity&lt;TId&gt;
          {
              public virtual TId Id { get; protected set; }
  
              public override bool Equals(object obj)
              {
                  return Equals(obj as Entity&lt;TId&gt;);
              }
          }
  
  I
  </code></pre>
  
  <p>n the controller, I set the model:</p>
  
  <pre><code>    public class MyModel
      {
          public Contact Contact { get; set; }
      }
  
  public ActionResult MyController()
  {
      MyModel model = new MyModel();
  
      model.Contact = ... //come from DB
  
      return PartialView("Contact", model);
  }
  </code></pre>
  
  <p>In the view, I do this :</p>
  
  <p><code>@Html.HiddenFor(m =&gt; m.Contact.Id)</code> (when I replace with a TextBoxFor, I see the correct value)</p>
  
  <p>When I post the form, in the controller all the value are in the model but the Contact.Id is 0 all the time</p>
  
  <p>I post like this : </p>
  
  <pre><code>var jqxhr = $.post("Controller/MyAction", $("form").serialize(),
      function (data) {
      });
  </code></pre>
  
  <p>In the controller :</p>
  
  <pre><code>[HttpPost]
  public ActionResult MyAction(MyModel model)
  {
      //model.Contact.Id equal 0 all the time
      //other value (fields) are ok.
  }
  </code></pre>
  
  <p>Any idea ?</p>
  
  <p>Thanks,</p>