MvcValidatorToolkit/Validator.cs
/// <summary>
/// Validates the given element using the Values collection and generates an error if 
/// invalid.
/// </summary>
Validates the given element using the Values collection and generates an error if
invalid.
Validates the given element using the Values collection and generates an error if invalid .
public bool Validate(NameValueCollection values, ValidationSet validationSet, List<string> skipElements)
		{
			if(values == null)
				throw new ArgumentNullException("values");
			if(validationSet == null)
				throw new ArgumentNullException("validationSet");
			Values = values;
			ValidationSet = validationSet;
			IsValid = true;
			ErrorMessages = new NameValueCollection();
			InvalidElements = new List<string>();
			foreach(string element in ElementsToValidate)
			{
				if(!skipElements.Contains(element))
					Validate(element);
			}
			if(ErrorMessages.Count > 0)
				IsValid = false;
			return IsValid;
		}
public bool Validate ( NameValueCollection values , ValidationSet validationSet , List < string > skipElements ) { if ( values == null ) throw new ArgumentNullException ( " " ) ; if ( validationSet == null ) throw new ArgumentNullException ( " " ) ; Values = values ; ValidationSet = validationSet ; IsValid = true ; ErrorMessages = new NameValueCollection ( ) ; InvalidElements = new List < string > ( ) ; foreach ( string element in ElementsToValidate ) { if ( ! skipElements . Contains ( element ) ) Validate ( element ) ; } if ( ErrorMessages . Count > 0 ) IsValid = false ; return IsValid ; }
Validates the given element using the Values collection and generates an error if
invalid.
Validates the given element using the Values collection and generates an error if invalid .
// Call the abstract Validate method for elements that are not on the  // skip list
values
NameValueCollection
validationSet
ValidationSet
skipElements
List<string>