User-265772647 posted
Hi,
I'm tring to validate date not selected future date.
in model
[DataType(DataType.Date)]
[RestrictedDate]// unable to access class
public
DateTime DateOfBirth {
get;
set; }
RestrictedDate.cs
internal
class
RestrictedDate:ValidateAttribute
{
public
override
bool IsValid(object date)
{
DateTime d = (DateTime)date;
return d<
DateTime.Now;
}
}
ValidateAttribute.cs
public
abstract
class
ValidateAttribute
{
public
abstract
bool IsValid(object date);
}