Top "Data-annotations" questions

Data Annotations are used by frameworks such as ASP.

ASP.NET MVC Validation form with AngularJS

I'm with a project in MVC 4 and AngularJS (+ twitter bootstrap). I usually use in my MVC projects "jQuery.Validate", "DataAnnotations" …

asp.net-mvc validation razor angularjs data-annotations
DataAnnotations: Recursively validating an entire object graph

I have an object graph sprinkled with DataAnnotation attributes, where some properties of objects are classes which themselves have validation …

c# .net validation recursion data-annotations
Validation of Guid

I have a strongly-typed view which has a DropDownListFor attribute on it. Each item in the dropdown list is represented …

c# asp.net-mvc data-annotations guid
ASP.NET-MVC 2 DataAnnotations StringLength

Can I use the MVC 2 DataAnnotations to specify a minimum length for a string field? Has anyone done this or …

asp.net-mvc-2 data-annotations
Why can't I use resources as ErrorMessage with DataAnnotations?

Why can't I do like this? [Required(ErrorMessage = "*")] [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessage = Resources.RegistrationModel.UsernameError)] public string Username { get; set; } …

c# asp.net asp.net-mvc resources data-annotations
Entity Framework 4.1 InverseProperty Attribute

Just wanted to know more about RelatedTo attribute and I found out it has been replaced by ForeignKey and InverseProperty …

c# entity-framework-4.1 data-annotations
Client form validation not working with modal dialog in MVC

I am changing a create form to become a modal dialog and jquery Unobtrusive validation stops working and don't know …

asp.net-mvc data-annotations unobtrusive-validation asp.net-mvc-viewmodel
How to automatically add placeholder attribute to html input type number in mvc 4?

This is a very specific issue. I managed to automatically add the placeholder attribute to html5 email input type by …

c# asp.net-mvc-4 data-annotations placeholder mvc-editor-templates
how to put DisplayName on ErrorMessage format

I have something like this: [DisplayName("First Name")] [Required(ErrorMessage="{0} is required.")] [StringLength(50, MinimumLength = 10, ErrorMessage="{0}'s length should be between {2} …

c# asp.net-mvc data-annotations
Compare (password) attribute

I'd like to create a view model for a new user using the code below. The "User" class contains just …

asp.net-mvc-3 passwords data-annotations