i'm trying to do a condition on a attribute having DateTime as a type,it has to be greaterThan another attribute of the same Object and lessThan another which is also an attribute of the same Object.My probleme is when i try to apply these two DataAnnotation it gives me this error:
Validation type names in unobtrusive client validation rules must be unique. The following validation type was seen more than once: is
i tried this after struggling with Range DataAnnotation,i know it's not the best way to do this,but Range just did'nt worked for me it always given me this error:
The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.
here is my model(i'm using entity framework to generate my models so i'm using partialclasses to do validation tricks):
[MetadataType(typeof(AffectationMetadata))]
public partial class AFFECTATION
{
public DateTime DateDebutVisite { set; get; }
public DateTime DateFinVisite { set; get; }
public class AffectationMetadata
{
//some other entities
[Required(ErrorMessage = "Date de début de visite est obligatoire.")]
[Display(Name = "Date du projet dans la période de la visite * :")]
[GreaterThan("DateDebutVisite")]
[LessThan("DateFinVisite")]
public DateTime DATEAFFECTATION { set; get; }
}
}
Please can someone tell me how can i solve this problem?