Skip to content

clsCheckBoxBinder

This binder connects a WebForms CheckBox to a business-object property and translates the UI state either into native booleans or caller-specified checked/unchecked strings. It sits on top of clsObjectBinderBase reflection helpers, optionally pushes changes back on CheckedChanged, and can be initialized from CheckBoxBindingArgs for manager-driven registration.

Purpose

  • Synchronize a CheckBox with a single bound property in either boolean or string-backed form.
  • Let callers define the persisted checked and unchecked tokens instead of forcing True/False.
  • Support event-driven updates without requiring custom page code.

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
CheckedString Property CheckedString As String Supplies the value written when the control is checked and string-mode binding is enabled.
UncheckedSTring Property UncheckedSTring As String Supplies the value written when the control is cleared and string-mode binding is enabled.
BindProperty Property BindProperty As String Names the business-object property that receives or provides the checkbox state.
BindSource Property BindSource As Object Holds the business object whose property is synchronized with the control.
CheckBox Property CheckBox As CheckBox Attaches the concrete control instance and registers it with the base binder pipeline.
CheckBoxTargetType Property CheckBoxTargetType As ObjectDataType Chooses whether the checkbox maps to a boolean property or to the configured string tokens.
Init() Overrides Sub Init() Hooks CheckedChanged when event-driven control-to-object updates are enabled for the current bind direction.
ObjectToControl() Overrides Function ObjectToControl() As Boolean Reads the bound property and sets the checkbox checked state from either a boolean value or the configured checked token.
New() Sub New() Creates an unconfigured binder for later property-based setup.
New(inArgs As CheckBoxBindingArgs) Sub New(inArgs As CheckBoxBindingArgs) Copies binding metadata, control references, and checked/unchecked token settings from a binding-arguments object.
## Inherited public members
Member Signature Purpose
--- --- ---
ContainsError ReadOnly Property ContainsError As 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().
IsDualBinding ReadOnly Property IsDualBinding As Boolean When true, ObjectToControl()/ControlToObject() read and write the display object/property while GetErrors() checks a separate validation object/property, as configured by AddDualBinder().
ControlPadding Property ControlPadding As 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.
ObjectPadding Property ObjectPadding As 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.
UsePadding Property UsePadding As Boolean Enables the ControlPadding/ObjectPadding transforms during ObjectToControl()/ControlToObject(); when false, values pass through unpadded regardless of the padding arguments configured.
UseEvents Property UseEvents As 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.
ControlErrors ReadOnly Property ControlErrors As ArrayList Holds the error text GetErrors() collects from the bound object's IDataErrorInfo implementation; Validate() aggregates these strings into the consolidated ErrorLabel/SAIFMessage output.
BindType Property BindType As BindTypes Determines which of ObjectToControl()/ControlToObject() actually run during DataBind()/BindToObject(), controlling whether this binder is push-only, pull-only, both, or validation-only.
FormControl Overridable Property FormControl As 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.
FormControlID Overridable ReadOnly Property FormControlID As String Supplied to Update() and error-focus logic to locate this binder's control instance on the page without holding a direct control reference.
Init() MustOverride Sub Init() 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.
ObjectToControl() MustOverride Function ObjectToControl() As 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.
ControlToObject() Protected Friend MustOverride Sub ControlToObject() 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.
SetControlFormat(inValid As Boolean) Protected Friend Overridable Sub SetControlFormat(inValid As Boolean) Called by Validate()/RefreshValidation() after error collection; sets the control's CssClass to the valid/error color per BR-BIND-001, BR-BIND-002, and BR-BIND-003, giving the reader a visual cue of validation state.
GetErrors() Protected Friend Overridable Sub GetErrors() 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.
GetObjectValueAsString(inBizObject, inPropertyName) Function GetObjectValueAsString(inBizObject As Object, inPropertyName As String) As String Used by ObjectToControl() to fetch the bound property's current value as display-ready text, applying ObjectPadding/ControlPadding first when UsePadding is enabled.
GetObjectValue(inBizObject, inPropertyName) Function GetObjectValue(inBizObject As Object, inPropertyName As String) As Object 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.
SetObjectValueAsString(inBizObject, inPropertyName, inValue) Protected Function SetObjectValueAsString(inBizObject As Object, inPropertyName As String, inValue As String) As Boolean 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.
SetObjectValue(inBizObject, inPropertyName, inValue) Protected Function SetObjectValue(inBizObject As Object, inPropertyName As String, inValue As Object) As Boolean 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.
ValidationKey Friend Overridable ReadOnly Property ValidationKey As String Computed by AddBinder() to key the bound object into m_ValidationObjects per BR-BIND-006, ensuring repeated Validate() passes re-check the correct distinct object.
IsSAIFFrameWorkObject Friend Overridable ReadOnly Property IsSAIFFrameWorkObject(Optional inObj As Object) As 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.
## Behavioral notes
- ObjectToControl() compares string-mode values case-insensitively before deciding whether the control should be checked.
- ControlToObject() writes True/False in boolean mode and the configured tokens in string mode.
- The binder overrides SetControlFormat() with a no-op, so it does not apply the base CSS error/highlight behavior.

Constraints and usage notes

  • CheckBoxTargetType must match the underlying property shape; otherwise SetObjectValue() receives an incompatible value.
  • Event-driven updates occur only when UseEvents is enabled and BindType is ControlToObject or TwoWay.

Sources

  • SAIF.Presentation.Web.Binding.Infragistics103\ASPControls\clsCheckBoxBinder.vb
  • SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBinderbase.vb