public void Add(string id, Control controlToValidate, string errorMessage) { if(!list.ContainsKey(id)) { WinRequiredFieldValidator validator = new WinRequiredFieldValidator(id,controlToValidate,errorMessage,this.parent); list.Add(id,validator); } else { throw new Exception("Item already exists in the collection."); } }
public void Add(WinRequiredFieldValidator value) { if(!list.ContainsKey( value.Id)) { value.Parent = this.parent; list.Add(value.Id,value); } else { throw new Exception("Item already exists in the collection."); } }