Vivek Joy

Vivek Joy

  • NA
  • 137
  • 25.4k

validation

Mar 2 2016 2:47 AM
This is my code in mvc
public class UserViewModel
{
[Key]
public int UserId { get; set; }
[Display(Name="Family Name")]
[Required]
public string FamilyName { get; set; }
[Required]
[Display(Name="Father Name")]
public string FatherName { get; set; }
[Required]
public string Name { get; set; }
[Display(Name="Family Unit Name")]
[Required]
public int FamilyUnitId { get; set; }
public virtual FamilyUnit FamilyUnit { get; set; }
[Required]
public string Username { get; set; }
[DataType(DataType.Password)]
[Required]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name="Confirm Password")]
[System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "Password doesnot match.")]
[Required]
public string ConfirmPassword { get; set; }
}
}
 
 
I have applied all the code of confirm password validation and when username exits it will show error
 
How to fix this error?Can anyone help me please 
 
 
 

Answers (2)