Top "Data-annotations" questions

Data Annotations are used by frameworks such as ASP.

DataAnnotations StringLength Attribute MVC - without max value

I am using Data Annotations for Model validation in MVC4 and am currently using the StringLengthAttribute however i do NOT …

asp.net-mvc asp.net-mvc-4 data-annotations minimum string-length
mvc [DataType(DataType.EmailAddress) no validation

I'm using this code on an email field: [Required] [DataType(DataType.EmailAddress)] [Display(Name = "Email address")] public string Email { get; …

asp.net-mvc asp.net-mvc-3 data-annotations
Greater Than or Equal To Today Date validation annotation in MVC3

Has anyone seen an MVC3 data annotation for Date validation that requires a single selected date to be equal to …

asp.net-mvc-3 datetime data-annotations
How to retrieve Data Annotations from code? (programmatically)

I'm using System.ComponentModel.DataAnnotations to provide validation for my Entity Framework 4.1 project. For example: public class Player { [Required] [MaxLength(30)] […

c# entity-framework-4.1 data-annotations
The DataAnnotations [Phone] Attribute

What is the default, valid format of the [Phone] attribute? In the data table, the phone column is navrchar (16) If …

c# regex asp.net-mvc validation data-annotations
How to handle Booleans/CheckBoxes in ASP.NET MVC 2 with DataAnnotations?

I've got a view model like this: public class SignUpViewModel { [Required(ErrorMessage = "Bitte lesen und akzeptieren Sie die AGB.")] [DisplayName("…

asp.net-mvc validation checkbox data-annotations
What is the proper data annotation to format my decimal property?

I have a POCO with a decimal property called SizeUS. I would like to use data annotations to format the …

c# asp.net-mvc data-annotations poco
DateTime (date and hour) validation with Data Annotation

I have the following code: [DisplayName("58.Date and hour of birth")] [DataType(DataType.DateTime, ErrorMessage = "Please enter a valid date …

asp.net-mvc datetime data-annotations
MVC Validation Lower/Higher than other value

How is the best way to validate a model in MVC.Net where I want to accept a minimum/maximum. …

c# asp.net-mvc asp.net-mvc-3 model data-annotations
Custom model validation of dependent properties using Data Annotations

Since now I've used the excellent FluentValidation library to validate my model classes. In web applications I use it in …

validation .net-3.5 asp.net-mvc-2 data-annotations