title: ViewModel in postback to controller is null
body: <p>i try to search this problem, but could not find a solution for it, <strong>please help me</strong>:</p>
  
  <p>my viewModel:</p>
  
  <pre><code>namespace webShop.ViewModels.Home
  {
      public class RegisterUserViewModel
      {
          public UserDB User { get; set; }
  
          public UsersDetaile UsersDetaile { get; set; }
  
          public IEnumerable&lt;state&gt; state { get; set; }
      }
  }
  </code></pre>
  
  <p>my model:</p>
  
  <pre><code>public partial class UserDB
  {
      public int Id { get; set; }
      public string Name { get; set; }
      public string Username { get; set; }
      public string Password { get; set; }
      public string Roles { get; set; }
      public byte Status { get; set; }
  
      public virtual UsersDetaile UsersDetaile { get; set; }
  }
  
  public partial class UsersDetaile
  {
      public int userID { get; set; }
      public Nullable&lt;System.DateTime&gt; BirthDate { get; set; }
      public string Mobile { get; set; }
      public string Tell { get; set; }
      public bool Gender { get; set; }
      public byte city { get; set; }
      public byte state { get; set; }
      public string postCode { get; set; }
      public string address { get; set; }
  
      public virtual City City1 { get; set; }
      public virtual State State{ get; set; }
      public virtual UserDB UserDB { get; set; }
  }
  </code></pre>
  
  <p>and my controller:</p>
  
  <pre><code>[HttpGet]
  public ActionResult Register()
  { 
      stateRepository stateRep = new stateRepository();
      var model = new RegisterUserViewModel();
      model.state = stateRep.Select().ToList();
      return View(model);
  }
  
  [HttpPost]
  public ActionResult Register(RegisterUserViewModel user) //Problem: postback viewModel is null
  {
     //My Code
  }
  </code></pre>
  
  <p>and my register view</p>
  
  <pre><code>@model webShop.ViewModels.Home.RegisterUserViewModel
  
  @using (Ajax.BeginForm("Register", "Home", new AjaxOptions { HttpMethod = "Post", Url = "/Home/Register" }))
  {
  
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    &lt;h1 class="block-header"&gt;Register&lt;/h1&gt;
        &lt;div class="group"&gt;
            &lt;label class="label"&gt;Name &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
            &lt;div class="controls"&gt;
                @Html.TextBoxFor(p =&gt; p.User.Name, new { @class = "text" })
                @Html.ValidationMessageFor(p =&gt; p.User.Name)
            &lt;/div&gt;
        &lt;/div&gt;
  
      //....
  
    &lt;div class="group"&gt;
          &lt;label class="label"&gt;Address &lt;/label&gt;
          &lt;div class="controls"&gt;
              @Html.TextBoxFor(p =&gt; p.UsersDetaile.address, new { @class = "text" })
              @Html.ValidationMessageFor(p =&gt; p.UsersDetaile.address)
          &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="form"&gt;
      &lt;div class="group"&gt;
          &lt;div class="controls"&gt;
               &lt;button class="button"&gt;Submit&lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  }
  </code></pre>
  
  <p>after press submit <strong>userDB</strong> and <strong>usersDetaile</strong> is <strong><em>null</em></strong>, what can i do?</p>