Top "Data-annotations" questions

Data Annotations are used by frameworks such as ASP.

DataAnnotations "NotRequired" attribute

I've a model kind of complicated. I have my UserViewModel which has several properties and two of them are HomePhone …

c# asp.net-mvc asp.net-mvc-3 data-annotations validationattribute
Unit Testing ASP.NET DataAnnotations validation

I am using DataAnnotations for my model validation i.e. [Required(ErrorMessage="Please enter a name")] public string Name { get; …

asp.net asp.net-mvc data-annotations
The field must be a number. How to change this message to another language?

How can I change that messages for all int fields so that instead of saying: The field must be a …

asp.net-mvc validation localization numbers data-annotations
How can I tell the Data Annotations validator to also validate complex child properties?

Can I automatically validate complex child objects when validating a parent object and include the results in the populated ICollection&…

c# validation data-annotations
MVC data annotations range validation not working properly

I have a RangeValidator on a property in my model to only allow Integers that are between 0 and 100. I have …

asp.net-mvc asp.net-mvc-3 jquery-ui data-annotations asp.net-mvc-validation
Allow empty strings for fields marked with PhoneAttribute or UrlAttribute

I'm using CodeFirst Entitty framework 5. I have a class representing a user. public class User { [Key] public int UserId { get; …

c# entity-framework validation ef-code-first data-annotations
Fluent Validation vs. Data Annotations

What are the operative differences between these two validation packages when used for ASP.NET MVC validatation? They seem to …

.net asp.net-mvc data-annotations fluentvalidation
How to use DataAnnotations ErrorMessageResourceName with custom Resource Solution

I'm building a MVC web application with C#. Since the site will be multilingual, I've implemented my own ResourceManager. This …

c# asp.net-mvc validation resources data-annotations
ASP.NET MVC datetime culture issue when passing value back to controller

How can i tell my controller/model what kind of culture it should expect for parsing a datetime? I was …

asp.net-mvc-3 validation data-annotations jquery-ui-datepicker
ASP.NET MVC 3 Data Annotation: Add validation dynamically

I'm new with data annotation. I'd like to know if it possible (and how) to add some validation dynamically. It …

asp.net validation asp.net-mvc-3 dynamic data-annotations