How many types of Data Annotation Attributes in MVC ?

Total Post:19

Points:133
C#
 70  View(s)
Ratings:
Rate this:

Types of validation in MVC...

  1. Post:31

    Points:219
    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!