public CompareValidator(string otherField, string errorMessage)
     : base(errorMessage)
 {
     Debug.Assert(!String.IsNullOrEmpty(otherField));
     _otherField = otherField;
     _clientValidationRule = new ModelClientValidationEqualToRule(errorMessage, otherField);
 }
        public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
        {
            ErrorMessage = UmbracoValidationHelper.GetDictionaryItem(_errorMessageDictionaryKey);

            var error = FormatErrorMessage(metadata.DisplayName);
            var rule = new ModelClientValidationEqualToRule(error, _otherProperty);

            yield return rule;
        }