Opposite of [compare(” “)] data annotation in .net?

You can use the [NotEqualTo] data annotation operator included in MVC Foolproof Validation. I used it right now and it works great!

MVC Foolproof is an open source library created by @nick-riggs and has a lot of available validators. Besides doing server side validation it also does client side unobtrusive validation.

Full list of built in validators you get out of the box:

Included Operator Validators

[Is]
[EqualTo]
[NotEqualTo]
[GreaterThan]
[LessThan]
[GreaterThanOrEqualTo]
[LessThanOrEqualTo]

Included Required Validators

[RequiredIf]
[RequiredIfNot]
[RequiredIfTrue]
[RequiredIfFalse]
[RequiredIfEmpty]
[RequiredIfNotEmpty]
[RequiredIfRegExMatch]
[RequiredIfNotRegExMatch]

Leave a Comment