I'm trying to combine RequiredIfNot
and Range
validators, without success.
The deal is: when the condition on RequiredIfNot
attribute is false, the Range
attribute starts to work, but it doesn't work.
Actually, the code I have is...
[Range(1, 100, "Out of the range")]
[RequiredIfNot("Field", "Value", "This field is required")]
public string TVCount { get; set; }
... but the Range
validator works everytime, and I want that it works only if RequiredIfNot
condition were false.
Is there a way (simple or not) to do this?