title: How to bind a nested property in a view with aspnet core
body: <p>I am starting to learn AspNetCore, and I would like to know how to bind a nested property in the view.</p>
  
  <p>I have this two object </p>
  
  <pre><code>public partial class Club
  {
      public Guid Id { get; set; }
      public string IdUser { get; set; }
      public string Name { get; set; }
      public string Position { get; set; }
      public virtual ApplicationUser IdUserNavigation { get; set; }
  }
  
  public class UserViewModel
  {
      public string Id { get; set; }
      public string UserName { get; set; }
      [DataType(DataType.Password)]
      public string Password { get; set; }
      [Display(Name = "Confirm Password")]
      [DataType(DataType.Password)]
      public string ConfirmPassword { get; set; }
      public string Name { get; set; }
      public string Email { get; set; }
  
      public Club Club { get; set; }
  
      public List&lt;SelectListItem&gt; ApplicationRoles { get; set; }
  
      [Display(Name = "Role")]
      public string ApplicationRoleId { get; set; }
  }
  </code></pre>
  
  <p>now I want to bind the UserViewModel to the view</p>
  
  <pre><code>    @model TestingViewModels.Users.UserViewModel
      @using Testing.ViewModels.Roles
  &lt;form asp-action="AddUser" role="form"&gt;
      @await Html.PartialAsync("_ModalHeader", new ModalHeader { Heading = "Add User" })
      &lt;div class="modal-body form-horizontal"&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-lg-6"&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label asp-for="Name" class="col-lg-3 col-sm-3 control-label"&gt;&lt;/label&gt;
                      &lt;div class="col-lg-6"&gt;
                          &lt;input asp-for="Name" class="form-control" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label asp-for="Email" class="col-lg-3 col-sm-3 control-label"&gt;&lt;/label&gt;
                      &lt;div class="col-lg-6"&gt;
                          &lt;input asp-for="Email" class="form-control" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label asp-for="ApplicationRoleId" class="col-lg-3 col-sm-3 control-label"&gt;&lt;/label&gt;
                      &lt;div class="col-lg-6"&gt;
                          &lt;select asp-for="ApplicationRoleId" asp-items="@Model.ApplicationRoles" class="form-control"&gt;
                              &lt;option&gt;Please select&lt;/option&gt;
                          &lt;/select&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              ....    
  
              &lt;div class="col-lg-6"&gt;
                  &lt;div class="form-group"&gt;
                      &lt;!--THIS DON´T WORK--&gt;
                      &lt;label asp-for="Club.Name" class="col-lg-3 col-sm-3 control-label"&gt;&lt;/label&gt;
                      &lt;div class="col-lg-6"&gt;
                          &lt;input asp-for="Club.Name" class="form-control" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                  &lt;!--THIS DON´T WORK--&gt;
                      &lt;label asp-for="Club.Position" class="col-lg-3 col-sm-3 control-label"&gt;&lt;/label&gt;
                      &lt;div class="col-lg-6"&gt;
                          &lt;input asp-for="Club.Position" class="form-control" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
      @await Html.PartialAsync("_ModalFooter", new ModalFooter { })
  &lt;/form&gt; 
  </code></pre>
  
  <p>How can I Bind Club.Name and Club.Position?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Jolynice</p>