clsCustomValidator¶
clsCustomValidator is a validation-only "binder" registered through clsObjectBindManager.AddCustomValidator. It never moves data — Init forces its bind type to ValidateOnly — and instead runs one of three application-supplied checks (a property-level delegate, a method-level delegate, or a whole-object IsValid check) whose results feed into the same error-aggregation pipeline as ordinary property bindings.
Purpose¶
- Let applications extend validation with custom logic without subclassing a control-specific binder (BR-BIND-051, see Run a custom validator).
- Force
BindType = ValidateOnlyonInitso custom validators never move data (BR-BIND-009). - Support three validation styles selected by
ValidationType:Property,Method, andObject(BR-BIND-051, BR-BIND-052, BR-BIND-053).
Context¶
- Namespace:
SAIF.Presentation.Web.Binding - Assembly/package:
SAIF.Presentation.Web.Binding.Infragistics111(ILMerged intoSAIF.Presentation.Web.Infragistics111.dll) - Base class:
clsObjectBinderBase
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ValidationType | Public Property ValidationType() As CustomValidationType |
Selects which delegate/check PerformValidation runs — Property, Method, or Object (BR-BIND-051, BR-BIND-052, BR-BIND-053). |
| PropertyValidationDelegate | Public Property PropertyValidationDelegate() As PropertyValidator |
Delegate invoked with the bind source, the bind property name, and the error list, for ValidationType = Property (BR-BIND-051). |
| MethodValidationDelegate | Public Property MethodValidationDelegate() As MethodValidator |
Delegate invoked with the validator itself, for ValidationType = Method; a False return marks an error (BR-BIND-052). |
| PerformValidation | Public Function PerformValidation() As Boolean |
Resets the error flag, then branches on ValidationType to run the configured delegate or read the bind source's IsValid (BR-BIND-051–BR-BIND-054). |
| Init | Public Overrides Sub Init() |
Forces BindType = BindTypes.ValidateOnly (BR-BIND-009). Overrides clsObjectBinderBase.Init. |
| ObjectToControl | Public Overrides Function ObjectToControl() As Boolean |
No-op; always returns True. Overrides clsObjectBinderBase.ObjectToControl. |
Inherited public members¶
Members in this section are inherited from clsObjectBinderBase. They are available on this type through inheritance.
| Member | Signature | Purpose | Origin |
|---|---|---|---|
| BindSource | Public Property BindSource() As Object |
The business object (or collection) this binder reads and writes. Setting it also sets the binder's validation source unless dual binding overrides it (BR-BIND-002). | SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| BindProperty | Public Property BindProperty() As String |
Name of the property on BindSource this binder gets/sets by reflection. |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| FormControl | Public Property FormControl() As Control |
The ASP.NET/Infragistics control instance this binder targets; its UniqueID is the key used by clsObjectBindManager.Binder and Update lookups. |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| BindType | Public Property BindType() As BindTypes |
Controls which directions data moves for this binder — ObjectToControl, ControlToObject, TwoWay, or ValidateOnly (BR-BIND-010). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| UseEvents | Public Property UseEvents() As Boolean |
Whether this binder subscribes to its control's change event in Init (BR-BIND-007, BR-BIND-008). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| ValidationKey | Friend Overridable ReadOnly Property ValidationKey() As String |
Computes the key under which this binder's validation object is registered — the business object's MyGuid for SAIF framework objects (via IsSAIFFrameWorkObject) or its type name otherwise (BR-BIND-004). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| IsSAIFFrameWorkObject | Friend Overridable ReadOnly Property IsSAIFFrameWorkObject() As Boolean |
Walks the bind source's runtime base-class chain for the names clsBusinessBase / clsBusinessCollectionBase to decide whether framework-specific keying and validation applies (BR-BIND-061). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| GetObjectValueAsString | Protected Function GetObjectValueAsString() As String |
Reads BindProperty from BindSource through TypeDescriptor/PropertyDescriptor and the property's TypeConverter, applying configured padding, for display in simple-value controls (BR-BIND-012, BR-BIND-013). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| SetObjectValueAsString | Protected Sub SetObjectValueAsString(inValue As String) |
Writes a string value back onto BindProperty. Computes a padded value for PadTarget.Object but assigns the unpadded value to the property, so object-side padding has no observable effect.* |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| GetErrors | Public Overridable Function GetErrors() As Boolean |
Selects the validation property/source for a dual binder (otherwise the bind property/source), casts it to IDataErrorInfo, and reads Item(property) to populate ControlErrors (BR-BIND-031, BR-BIND-032, BR-BIND-033). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| ControlErrors | Public ReadOnly Property ControlErrors() As ArrayList |
The list of non-blank, CRLF-split, <BR>-stripped error message fragments harvested for this binder in the current validation pass. |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| SetControlFormat | Public Sub SetControlFormat(inValid As Boolean) |
Applies error or valid CSS/color styling to FormControl based on control kind — errorbordercolor/errorbackcolor when invalid (BR-BIND-037, BR-BIND-038), normal/defaultbackcolor when valid, honoring an existing disabledbackcolor class (BR-BIND-039, BR-BIND-040). |
SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
| SetDualBinding | Friend Sub SetDualBinding(inValidationSource As Object, inValidationProperty As String) |
Records a validation object/property distinct from the bind object/property, so the control can display one object while validating another (BR-BIND-059). | SAIF.Presentation.Web.Binding.Infragistics111 — clsObjectBinderBase |
Behavioral notes¶
- In the
Propertybranch, the delegate appends messages toControlErrorsdirectly butPerformValidationnever setsm_Errors = True, so those messages do not mark the validator as erroring and may not surface throughclsObjectBindManager.Validate().* - A
Nothingdelegate is a silent no-op (BR-BIND-054).
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service. They describe inherited behavior from the indicated origin library and should be verified if the dependency version changes.
Sources¶
- SAIF.Presentation.Web.Binding.Infragistics111/clsCustomValidator.vb