---
title: clsCustomValidator
summary: API reference for clsCustomValidator.
status: draft
owner: SAIF documentation team
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Binding.Infragistics103
reference_type: embedded
---

# clsCustomValidator

This specialized binder participates in the same manager validation pipeline as control binders, but it exists to run caller-supplied validation logic or whole-object `IsValid` checks instead of transferring values between a control and an object property. `clsObjectBindManager` creates it through `AddCustomValidator`, and the instance dispatches validation in property, method, or object mode depending on `ValidationType`.

## Purpose
- Let pages register validation work that does not fit a normal control-to-property binder.
- Reuse the manager's aggregation, formatting, and first-error tracking pipeline for custom validation scenarios.
- Dispatch validation through property delegates, method delegates, or whole-object `IsValid` checks from one binder implementation.

## Context
- Namespace: `SAIF.Presentation.Web.Binding`
- Assembly/package: `SAIF.Presentation.Web.Binding.Infragistics103` (embedded/bundled as source, not independently packaged)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| ValidationType | `Public Property ValidationType() As CustomValidationType` | Chooses whether validation runs in Property, Method, or Object mode. |
| BindProperty | `Public Property BindProperty() As String` | Identifies the property name passed to a property-level validator. |
| BindSource | `Public Property BindSource() As Object` | Supplies the target object being validated and also becomes the validation source used by the base class. |
| MethodValidationDelegate | `Public Property MethodValidationDelegate() As CustomValidator` | Supplies the delegate invoked for method-level validation. |
| PropertyValidationDelegate | `Public Property PropertyValidationDelegate() As PropertyValidator` | Supplies the delegate invoked for property-level validation. |
| Init | `Public Overrides Sub Init()` | Forces the binder into `ValidateOnly` mode so it participates in validation without normal value transfer. |
| PerformValidation | `Protected Friend Overrides Function PerformValidation() As Boolean` | Executes the selected Property, Method, or Object validation path and updates the error state. |
| ObjectToControl | `Public Overrides Function ObjectToControl() As Boolean` | Returns success without changing a control because this validator has no outbound binding role. |
| ControlToObject | `Protected Friend Overrides Sub ControlToObject()` | Performs no inbound transfer because validation, not value synchronization, is this type's responsibility. |

## Inherited public members

Members in this section are inherited from `clsObjectBinderBase` in `SAIF.Presentation.Web.Binding.Infragistics103`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| ContainsError | `ReadOnly Property, Boolean` | Set by GetErrors()/validation processing; when true, Validate()/RefreshValidation() counts this binder toward the overall invalid result and its control receives error-state CSS via SetControlFormat(). | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| IsDualBinding | `ReadOnly Property, Boolean` | When true, ObjectToControl()/ControlToObject() read and write the display object/property while GetErrors() checks a separate validation object/property, as configured by AddDualBinder(). | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| ControlPadding | `Property, PadArgs` | When UsePadding is enabled, pads or trims the value written to the control during ObjectToControl(), so fixed-width display formatting is applied without changing the underlying object value. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| ObjectPadding | `Property, PadArgs` | When UsePadding is enabled, pads or strips padding from the value written back to the bound property during ControlToObject(), so stored data is not polluted with display-only padding characters. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| UsePadding | `Property, Boolean` | Enables the ControlPadding/ObjectPadding transforms during ObjectToControl()/ControlToObject(); when false, values pass through unpadded regardless of the padding arguments configured. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| UseEvents | `Property, Boolean` | When true, Init() wires the control's native change event so a user edit immediately calls ControlToObject() instead of waiting for an explicit BindToObject()/Validate() call. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| ControlErrors | `ReadOnly Property, ArrayList` | Holds the error text GetErrors() collects from the bound object's IDataErrorInfo implementation; Validate() aggregates these strings into the consolidated ErrorLabel/SAIFMessage output. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| BindType | `Property, BindTypes` | Determines which of ObjectToControl()/ControlToObject() actually run during DataBind()/BindToObject(), controlling whether this binder is push-only, pull-only, both, or validation-only. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| FormControl | `Property, WebControl` | Setting this property runs ProcessControl, which applies binder-specific control setup (event wiring readiness, CSS baseline) before the control participates in binding and validation passes. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| FormControlID | `ReadOnly Property, String` | Supplied to Update() and error-focus logic to locate this binder's control instance on the page without holding a direct control reference. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| Init() | `MustOverride Sub` | Called once during AddBinder() registration; each concrete binder overrides this to hook the native control event needed for event-driven ControlToObject() and to perform any control-specific setup. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| ObjectToControl() | `MustOverride Function, Boolean` | Invoked by DataBind() for binders configured as ObjectToControl/TwoWay; each concrete binder overrides this to translate the bound property's value into the control-specific display state. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| ControlToObject() | `MustOverride Sub, Protected Friend` | Invoked by BindToObject() for binders configured as ControlToObject/TwoWay; each concrete binder overrides this to convert the control's current value back into the bound property's type. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| SetControlFormat(inValid As Boolean) | `Overridable Sub` | Called by Validate()/RefreshValidation() after error collection; sets the control's CssClass to the valid/error color per [BR-BIND-001](../../business-rules.md#br-bind-001-error-css-suppression-for-protected-fields), [BR-BIND-002](../../business-rules.md#br-bind-002-gridlist-controls-exempt-from-cell-level-errorvalid-css), and [BR-BIND-003](../../business-rules.md#br-bind-003-multi-line-textbox-error-styling-differs-from-single-line), giving the reader a visual cue of validation state. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| GetErrors() | `Overridable Sub` | Reads the bound object's IDataErrorInfo.Item(property) during Validate()/RefreshValidation() and appends any non-empty message to ControlErrors, driving both ContainsError and the consolidated error display. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| GetObjectValueAsString | `Function` | Used by ObjectToControl() to fetch the bound property's current value as display-ready text, applying ObjectPadding/ControlPadding first when UsePadding is enabled. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| GetObjectValue | `Function` | Used by ObjectToControl() and type-sensitive binders to fetch the bound property's value in its native CLR type, before any control-specific conversion or formatting. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| SetObjectValueAsString | `Protected Function` | Used by ControlToObject() to write a control-derived string back onto the bound property, applying padding/trim rules first when UsePadding is enabled, so the object receives a correctly formatted value. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| SetObjectValue | `Protected Function` | Used by ControlToObject() to write a converted, strongly typed value back onto the bound property, bypassing string formatting for binders that perform their own type conversion. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| ValidationKey | `ReadOnly Property, String` | Computed by AddBinder() to key the bound object into m_ValidationObjects per [BR-BIND-006](../../business-rules.md#br-bind-006-validation-key-derivation-for-saif-framework-objects), ensuring repeated Validate() passes re-check the correct distinct object. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |
| IsSAIFFrameWorkObject | `ReadOnly Property, Boolean` | Used by Validate()/GetErrors() to decide whether the bound object exposes IsValid/IDataErrorInfo semantics consistent with the SAIF business-object framework, gating which error-harvesting path is taken. | `SAIF.Presentation.Web.Binding.Infragistics103` — `clsObjectBinderBase` |

## Behavioral notes
- In Property mode, `PerformValidation()` invokes `PropertyValidationDelegate` with the bound source object, property name, and `ControlErrors` collection.
- In Method mode, `PerformValidation()` invokes `MethodValidationDelegate(Me)` and sets the binder error flag when the delegate returns `False`.
- In Object mode, `PerformValidation()` looks for an `IsValid` property on SAIF framework objects and returns that Boolean result to the manager.
- `BindSource` also sets the base validation source, so manager-side validation tracking uses the same object identity and [BR-BIND-006](../../business-rules.md#br-bind-006-validation-key-derivation-for-saif-framework-objects) behavior as ordinary binders.

## Constraints and usage notes
- `Init()` forces `BindType = ValidateOnly`, so this binder is not used for normal object-to-control or control-to-object transfer.
- Property and method modes require the caller to supply the corresponding delegate; the binder does not synthesize validation logic on its own.
- Object mode relies on the target exposing an `IsValid` property and being recognized as a SAIF framework object by the inherited base-class check.

## Sources
- `SAIF.Presentation.Web.Binding.Infragistics103\clsCustomValidator.vb`
- `SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBinderbase.vb`