Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,
Im having a challenge using the Unobtrusive Validation and i created two classes one validatin a set of rule and another one a set of a rule.
i invoke them using this technique...
C#
[ValidationRuleX(ErrorMessageResourceName = "WSEARCH_VALIDATION_WILL_XRULE", 
		    ErrorMessageResourceType = typeof(SanlamTrust.Localisation.strings))
		]
[ValidationRuleDigit(ErrorMessageResourceName = "WSEARCH_VALIDATION_WILL_DIGITRULE",
			ErrorMessageResourceType = typeof(SanlamTrust.Localisation.strings))
		]
public string WillNumber { get; set; }

They are both validating the same control which is WillNumber....
The implementation of both classes header look like this
C#
public class ValidationRuleDigitAttribute : ValidationAttribute, IClientValidatable{}

C#
public class ValidationRuleXAttribute : ValidationAttribute, IClientValidatable{}


When i execute the program is returns this error:
Validation type names in unobtrusive client validation rules must be unique.
I checked in most site with people who have encountered this and they advice for a creation of other property in your like this:
C#
public ModelClientValidationNotEqualToRule(string errorMessage, string otherProperties)
        {
            ErrorMessage = errorMessage;
            ValidationType = "willnumber";
            ValidationParameters.Add("otherproperties", otherProperties);
        }


In my case im using only one field not multiple fields...

Thanx in advance
Mninawa
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900