Use this attribute:
public class CustomDateAttribute : RangeAttribute
{
public CustomDateAttribute()
: base(typeof(DateTime),
DateTime.Now.AddYears(-6).ToShortDateString(),
DateTime.Now.ToShortDateString())
{ }
}
More Related Contents:
- The model item passed into the dictionary is of type .. but this dictionary requires a model item of type
- better way to load 2 dropdown in mvc
- How do I use a C# keyword as a property name?
- ASP.NET MVC Binding to a dictionary
- Dependency Injection in attributes
- How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller?
- How to get the public IP address of a user in C#
- Could not find a part of the path … bin\roslyn\csc.exe
- How can I get this ASP.NET MVC SelectList to work?
- How to get current user, and how to use User class in MVC5?
- How to call another controller Action From a controller in Mvc
- Web API Put Request generates an Http 405 Method Not Allowed error
- How to update a claim in ASP.NET Identity?
- ModelState.IsValid == false, why?
- What does it mean for a property to be [Required] and nullable?
- Getting All Controllers and Actions names in C#
- Converting ASP.NET MVC Razor @helper function into a method of a helper class
- LINQ to Entities does not recognize the method ‘System.Web.Mvc.FileResult’
- How to elegantly deal with timezones
- ASP.NET MVC Razor render without encoding
- How to redirect to Index from another controller?
- C# Entity-Framework: How can I combine a .Find and .Include on a Model Object?
- Put content in HttpResponseMessage object?
- How to manually validate a model with attributes?
- MEF with MVC 4 or 5 – Pluggable Architecture (2014)
- How to retain spaces in DropDownList – ASP.net MVC Razor views
- How do you post a JSON file to an ASP.NET MVC Action?
- How to use SqlClient in ASP.NET Core?
- How can I maintain ModelState with RedirectToAction?
- what are the URLs for in claim-types