Top "Data-annotations" questions

Data Annotations are used by frameworks such as ASP.

Foreign keys in entity framework 4.1

I am working on Entity Framework 4.1 and using data annotations for foreign keys. I want to know how can we …

.net data-annotations ef-code-first entity-framework-4.1
MVC: Override default ValidationMessage

In the world of MVC I have this view model... public class MyViewModel{ [Required] public string FirstName{ get; set; } } ...and …

asp.net-mvc data-annotations html-helper
Validating an e-mail address with unobtrusive javascript / MVC3 and DataAnnotations

jQuery Validation makes it simple to validate an email address: $("someForm").validate({ rules: { SomeField: { required: true, email: true, remote: { type: "…

c# asp.net-mvc-3 data-annotations unobtrusive-javascript unobtrusive-validation
How to bind view model property with different name

Is there a way to make a reflection for a view model property as an element with different name and …

asp.net-mvc razor data-annotations model-binding asp.net-mvc-5
Data Annotations with Entity Framework 5.0 (database first)

What is the best way to use data annotations for validation if I'm using an Entity Framework (v5.0) database first …

c# entity-framework entity-framework-5 data-annotations
Using DataAnnotations on Windows Forms project

I recently used ASP.Net MVC with DataAnnotations and was thinking of using the same approach for a Forms project …

c# asp.net-mvc winforms c#-3.0 data-annotations
DataAnnotation for Required property

First it works, but today it failed! This is how I define the date property: [Display(Name = "Date")] [Required(ErrorMessage = "…

asp.net-mvc-4 asp.net-web-api data-annotations
Conditional data annotation

Is there a way to make a data annotation conditional? I have a table Party where I store both organisations …

asp.net-mvc validation data-annotations
Get DisplayAttribute attribute from PropertyInfo

class SomeModel { [Display(Name = "Quantity Required")] public int Qty { get; set; } [Display(Name = "Cost per Item")] public int Cost { get; …

c# .net reflection data-annotations propertyinfo
About Enum and DataAnnotation

I have this Enum (Notebook.cs): public enum Notebook : byte { [Display(Name = "Notebook HP")] NotebookHP, [Display(Name = "Notebook Dell")] NotebookDell } …

c# enums data-annotations asp.net-mvc-5.2 displayattribute