Top "Data-annotations" questions

Data Annotations are used by frameworks such as ASP.

Int or Number DataType for DataAnnotation validation attribute

On my MVC3 project, I store score prediction for football/soccer/hockey/... sport game. So one of properties of my …

asp.net-mvc asp.net-mvc-3 data-annotations
Assign format of DateTime with data annotations?

I have this attribute in my view model: [DataType(DataType.DateTime)] public DateTime? StartDate { get; set; } If I want to …

c# asp.net asp.net-mvc data-annotations
DataAnnotations validation (Regular Expression) in asp.net mvc 4 - razor view

The DataAnnotations validator not working in asp.net mvc 4 razor view, when using the special characters in the regular expression. …

asp.net-mvc regex razor data-annotations
Disable Required validation attribute under certain circumstances

I was wondering if it is possible to disable the Required validation attribute in certain controller actions. I am wondering …

c# asp.net-mvc asp.net-mvc-3 data-annotations
ASP.NET MVC: Custom Validation by DataAnnotation

I have a Model with 4 properties which are of type string. I know you can validate the length of a …

c# .net asp.net-mvc asp.net-mvc-3 data-annotations
How to specify a min but no max decimal using the range data annotation attribute?

I would like to specify that a decimal field for a price must be >= 0 but I don't really want …

c# .net asp.net-mvc data-annotations
How to add "required" attribute to mvc razor viewmodel text input editor

I have the following MVC 5 Razor HTML helper: @Html.TextBoxFor(m => m.ShortName, new { @class = "form-control", @placeholder = "short name"}) …

asp.net-mvc razor data-annotations html-helper
displayname attribute vs display attribute

What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?

c# asp.net-mvc data-annotations displayattribute .net-attributes
Why can't I reference System.ComponentModel.DataAnnotations?

I'm trying to use DataAnnotations in my WPF project to specify a maximum length of strings, with the following: using …

c# wpf data-annotations
Entity Framework code first unique column

I am using Entity Framework 4.3 and using Code Fist. I have a class public class User { public int UserId{get;…

entity-framework data-annotations entity-framework-4.3