Top "Data-annotations" questions

Data Annotations are used by frameworks such as ASP.

IValidatableObject Validate method firing when DataAnnotations fails

I've a ViewModel which has some DataAnnotations validations and then for more complex validations implements IValidatableObject and uses Validate method. …

asp.net asp.net-mvc asp.net-mvc-3 data-annotations ivalidatableobject
Asp.Net MVC EnableClientValidation doesn't work

I want as well as Client Side Validation as Server Side Validation. I realized this as the following: Model: ( The …

validation asp.net-mvc-2 data-annotations client-side-validation
How can I use the Data Validation Attributes in C# in a non-ASP.net context?

I'd like to use the data validation attributes in a library assembly, so that any consumer of the data can …

c# validation data-annotations
How do I invoke a validation attribute for testing?

I am using the RegularExpressionAttribute from DataAnnotations for validation and would like to test my regex. Is there a way …

c# validation unit-testing data-annotations dynamic-data
Providing localized error messages for non-attributed model validation in ASP.Net MVC 2?

I'm using the DataAnnotations attributes along with ASP.Net MVC 2 to provide model validation for my ViewModels: public class ExamplePersonViewModel { […

asp.net-mvc localization data-annotations
ASP.Net Mvc Fixed-Length String Data Annotation

How can I set the string validation for a fixed-length string using data annotation ? I want to have a property …

asp.net-mvc validation asp.net-mvc-4 data-annotations client-side-validation
Web API nullable required property requires DataMember attribute

I am receiving the following VM on a Web API Post action public class ViewModel { public string Name { get; set; } […

asp.net-mvc asp.net-web-api data-annotations
ASP.NET MVC4 Multi-lingual Data Annotations

In a standard application I have the following: [Required] [DisplayName("Email Address")] public string EmailAddress { get; set; } ...this in turn …

c# .net asp.net-mvc data-annotations multilingual
client-side validation trips on DataAnnotation Range attribute

I have the following code in my Model class: [Range(1, 100)] public decimal Price { get; set; } After recent upgrade (I assume) …

asp.net-mvc-4 jquery-validate data-annotations unobtrusive-validation
DataAnnotations and Resources don't play nicely

I'm using dataannotations in an MVC2 app and am a little discouraged when trying to use RESX file resources for …

asp.net-mvc data-annotations globalization resx