Пример #1
0
		public void Deny_Unrestricted ()
		{
			ValidatorCollection vc = new ValidatorCollection ();

			Assert.AreEqual (0, vc.Count, "Count");
			Assert.IsFalse (vc.IsReadOnly, "IsReadOnly");
			Assert.IsFalse (vc.IsSynchronized, "IsSynchronized");
			Assert.IsNotNull (vc.SyncRoot, "SyncRoot");

			vc.Add (null);
			Assert.IsNull (vc[0], "this[int]");
			Assert.IsTrue (vc.Contains (null), "Contains");
			Assert.IsNotNull (vc.GetEnumerator (), "GetEnumerator");
			vc.Remove (null);

			IValidator validator = new CustomValidator ();
			vc.Add (validator);
			vc.CopyTo (new IValidator[1], 0);
		}
Пример #2
0
	public ValidatorCollection GetValidators (string validationGroup)
	{			
		if (validationGroup == String.Empty)
			validationGroup = null;

		ValidatorCollection col = new ValidatorCollection ();
		if (_validators == null)
			return col;
		
		foreach (IValidator v in _validators)
			if (BelongsToGroup(v, validationGroup))
				col.Add(v);

		return col;
	}
Пример #3
0
	bool ValidateCollection (ValidatorCollection validators)
	{
		if (validators == null || validators.Count == 0)
			return true;

		bool all_valid = true;
		foreach (IValidator v in validators){
			v.Validate ();
			if (v.IsValid == false)
				all_valid = false;
		}

		return all_valid;
	}
 public FieldEditorControl()
 {
     this._EditorDisplayMode = EditorDisplayMode.Div;
     this._EditControlStyle = new Style();
     this._ErrorStyle = new Style();
     this._HelpStyle = new Style();
     this._LabelStyle = new Style();
     this._VisibilityStyle = new Style();
     this._ShowRequired = true;
     this._ShowVisibility = false;
     this.Validators = new ValidatorCollection();
     this._IsValid = true;
     this._Validated = false;
 }
 public ValidatorCollection GetValidators(string validationGroup)
 {
     if (validationGroup == null)
     {
         validationGroup = string.Empty;
     }
     ValidatorCollection validators = new ValidatorCollection();
     if (this._validators != null)
     {
         for (int i = 0; i < this.Validators.Count; i++)
         {
             BaseValidator validator = this.Validators[i] as BaseValidator;
             if (validator != null)
             {
                 if (string.Compare(validator.ValidationGroup, validationGroup, StringComparison.Ordinal) == 0)
                 {
                     validators.Add(validator);
                 }
             }
             else if (validationGroup.Length == 0)
             {
                 validators.Add(this.Validators[i]);
             }
         }
     }
     return validators;
 }
Пример #6
0
	public ValidatorCollection GetValidators (string validationGroup)
	{
		if (validationGroup == null || validationGroup == "")
			return Validators;

		if (_validatorsByGroup == null) _validatorsByGroup = new Hashtable ();
		ValidatorCollection col = _validatorsByGroup [validationGroup] as ValidatorCollection;
		if (col == null) {
			col = new ValidatorCollection ();
			_validatorsByGroup [validationGroup] = col;
		}
		return col;
	}
Пример #7
0
	void ValidateCollection (ValidatorCollection validators)
	{
		if (validators == null || validators.Count == 0){
			_isValid = true;
			return;
		}

		bool all_valid = true;
		foreach (IValidator v in validators){
			v.Validate ();
			if (v.IsValid == false)
				all_valid = false;
		}

		if (all_valid)
			_isValid = true;
	}