How many types of Data Annotation Attributes in MVC ?

Total Post:46

Points:324

C#
 543  View(s)
Ratings:
Rate this:

Types of validation in MVC...

  1. Re: How many types of Data Annotation Attributes in MVC ?

    Data Annotations in Asp.Net MVC

    How many types of Data Annotation Attributes in MVC ?

    OR

    Key [Key]
    public int StudentID { get; set; }
    DisplayName [DisplayName("StudentName")]
    Required [Required(ErrorMessage = "Enter Student Name")]
    DataType [DataType(DataType.Password)]
    StringLength [StringLength(50, ErrorMessage = "Only 50 character are allowed")]
    DisplayFormat [DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}")]
    Regular Expression [RegularExpression(@"[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}", ErrorMessage = "Please enter Valid Email ID")]
    Range [Range(5000, 15000, ErrorMessage = "Please enter valid range")]
    Bind [Bind(Exclude = "StudentID")]
    Compare [DataType(DataType.Password)]
    [Required(ErrorMessage = "Please enter password")]
    public string Password { get; set; }

    [Required(ErrorMessage = "Please enter ConfirmPassword")]
    [DataType(DataType.Password)]
    [Compare("Password", ErrorMessage = "Password not matching")]
    public string ConfirmPassword { get; set; }


Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.