title: Update only part of a Model, validation problem?
body: <p>I have a sign-up page where the user can input his FirstName, LastName, Email and Password, along with other fields. </p>
  
  <p>I have bound validation attributes to this Model (called "User" and created via LINQtoSQL) and all works well.</p>
  
  <p>Model code:</p>
  
  <pre><code>[MetadataType(typeof(UserValidation))]
  public partial class User { }
  
  [Bind(Exclude = "UserID")]
  [PropertiesMustMatch("Password", "ConfirmPassword", ErrorMessage = "The password and confirm password don't match.")]
  public class UserValidation 
  {
      [Required(ErrorMessage = "First name required"), StringLength(20, MinimumLength=3, ErrorMessage = "Must be between 3 and 20 characters")]
      public string FirstName { get; set; }
  
      [Required(ErrorMessage = "Last name required"), StringLength(20, MinimumLength = 3, ErrorMessage = "Must be between 3 and 20 characters")]
      public string LastName { get; set; }
  
      [Required(ErrorMessage = "Email address required"), RegularExpression("^[a-z0-9_\\+-]+(\\.[a-z0-9_\\+-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*\\.([a-z]{2,4})$", ErrorMessage = "Must be a valid email address")]
      public string Email { get; set; }
  
      [Required(ErrorMessage = "Password required"), StringLength(20, MinimumLength = 6, ErrorMessage = "Password must be between 6 and 20 characters")]
      public string Password { get; set; }
  
      [Required(ErrorMessage = "Confirm password required"), StringLength(20, MinimumLength = 6, ErrorMessage = "Password must be between 6 and 20 characters")]
      public string ConfirmPassword { get; set; }
  
  }
  </code></pre>
  
  <p>After sign-up and login, I want the user to be able to edit their FirstName, LastName and Email (lets call these "Account" fields) in one View and "Password" in another. This is where my problem lies.</p>
  
  <p>When I submit a form updating the Account fields data via the same Model ("User") used in the sign-up, the IsValid method flairs up a ModelState error for the missing "Password" field.</p>
  
  <p>Controller code:</p>
  
  <pre><code>    //
      // GET /Talent/Account
      public ActionResult Account()
      {
          string cookieUser = User.Identity.Name;
          User user = userRepository.GetUserByEmail(cookieUser);
          return View(user);
      }
  
      // POST /Talent/Account
      [HttpPost]
      public ActionResult Account(User model)
      {
  
          if (ModelState.IsValid)
          {
      // do something
              ModelState.AddModelError("", "All good.. "+ model.FirstName + " - " + model.LastName);
          }
  
          return View(model);
      }
  </code></pre>
  
  <p>How can I get around this?? Best practice etc...</p>