Custom validator registration¶
This operation registers a clsCustomValidator binder that supports validation scenarios beyond a simple property-to-control binding, dispatching to a caller-supplied delegate or to the bound object's own IsValid property.
| Field | Value |
|---|---|
| Operation ID | OP-BIND-005 |
| Trigger | Page code calling AddCustomValidator(target), AddCustomValidator(target, keyProperty, propertyValidator), or AddCustomValidator(control, target, validationMethod) on clsObjectBindManager |
| Inputs | Bound target object; optional key property + PropertyValidator delegate; optional control + CustomValidator delegate |
| Outputs | A clsCustomValidator binder appended via AddBinder() |
| Primary components | clsObjectBindManager.AddCustomValidator, clsCustomValidator.PerformValidation |
| Entry point | SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBindManager.vb |
Steps¶
- Construct
New clsCustomValidator. - Set
BindSource/BindPropertyandValidationType(Object,Property, orMethod, depending on the overload used), and the corresponding delegate property (PropertyValidationDelegateorMethodValidationDelegate). - Call
AddBinder()(same registration logic as the standardAdd()family — see Register and initialize a control binding). - At
Validate()time (Validate bound controls),clsCustomValidator.PerformValidation()dispatches onValidationType: Property: invokes the caller'sPropertyValidatordelegate againstBindSource/BindProperty/ControlErrors.Method: invokes the caller'sCustomValidatordelegate againstMe(the validator instance), settingm_Errors = Trueif it returnsFalse.Object: reflectively readsIsValidon the bound SAIF framework object (only ifIsSAIFFrameWorkObject()is true).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([AddCustomValidator called]) --> Construct[Construct clsCustomValidator]
Construct --> SetProps[Set BindSource, BindProperty, ValidationType, delegate]
SetProps --> AddBinder[AddBinder: register in m_Bindings]
AddBinder --> Later[At Validate time: PerformValidation dispatches]
Later --> Mode{ValidationType?}
Mode -->|Property| PropDelegate[Invoke PropertyValidator delegate]
Mode -->|Method| MethodDelegate[Invoke CustomValidator delegate]
Mode -->|Object| ObjectCheck[Reflectively read IsValid if SAIF framework object]
PropDelegate --> EndOk([Validation result contributes to overall Validate result])
MethodDelegate --> EndOk
ObjectCheck --> EndOk
Failure and edge-case behavior¶
- For
ValidationType.Object, if the bound object is not recognized as a SAIF framework object (IsSAIFFrameWorkObject()returns false), noIsValidcheck is performed and the validator effectively contributes no error.*
Related documentation¶
Sources¶
SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBindManager.vbSAIF.Presentation.Web.Binding.Infragistics103\clsCustomValidator.vb