Skip to content

Validate bound controls

This operation synchronizes control values into their bound objects, harvests validation errors from each bound business object via IDataErrorInfo/IsValid, aggregates the unique error messages, and applies error/valid CSS formatting to the corresponding controls.

Field Value
Operation ID OP-BIND-004
Trigger Explicit call to Validate() or RefreshValidation() from the consuming page
Inputs Current m_Bindings, m_ValidationObjects
Outputs Boolean overall valid/invalid result; populated m_Errors; control CSS formatting; ErrorLabel/SAIFMessage text
Primary components clsObjectBindManager.Validate, clsObjectBindManager.RefreshValidation, clsObjectBinderBase.GetErrors, clsObjectBinderBase.SetControlFormat
Entry point SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBindManager.vb

Steps

  1. Call BindToObject() to sync non-event-driven controls into their objects (see Control to object data pull).
  2. Clear m_Errors and reset m_FirstErrorControl.
  3. (Validate() only) Call the private ValidateBindSources(): for each distinct object in m_ValidationObjects, reflectively read its IsValid property if present — this forces framework business objects to (re)compute their rule state; the result is read but not otherwise branched on in this method body.*
  4. Iterate m_Bindings: for each binder, call PerformValidation() if IsCustomValidator is true (custom validator delegate/Object-mode IsValid check), else call GetErrors() (reads IDataErrorInfo.Item(property) on the bound/validation object, splits on vbCrLf, strips <BR> tags, populates ControlErrors).
  5. If the binder has errors:
  6. Mark the overall result invalid.
  7. Add unique error strings to m_Errors (BR-BIND-005).
  8. Record m_FirstErrorControl if not already set.
  9. Call Binder.SetControlFormat(False) — applies errorbackcolor/errorbordercolor CSS, skipping grids/checkbox-lists (BR-BIND-002) and varying by TextBox.MultiLine state (BR-BIND-003).
  10. If the binder has no errors, apply valid CSS via SetControlFormat(True) (BR-BIND-001), unless the binder's control is the same as m_FirstErrorControl (BR-BIND-004).
  11. If ErrorLabel is set, write FormattedErrorMessage (all unique errors joined with <BR>) to it; likewise for SAIFMessage if set.
  12. Return the overall boolean result.
  13. RefreshValidation() follows the identical sequence but omits step 3 (ValidateBindSources()), per its stated purpose of refreshing control formatting without re-validating bind sources.
  14. No SQL/table interaction occurs; no delegation into a referenced-library operation beyond invoking the bound business object's own IDataErrorInfo/IsValid members (defined in SAIF.BOF.Framework, outside this library's source — treated as an external/framework call, not traced further).*

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Validate/RefreshValidation called]) --> Bind[BindToObject: sync controls to objects]
    Bind --> Reset[Clear m_Errors, reset m_FirstErrorControl]
    Reset --> Refresh{Is this RefreshValidation?}
    Refresh -->|No| ValidateSources[ValidateBindSources: read IsValid per distinct object]
    Refresh -->|Yes| IterateBinders[Iterate m_Bindings]
    ValidateSources --> IterateBinders
    IterateBinders --> Custom{IsCustomValidator?}
    Custom -->|Yes| PerformValidation[PerformValidation]
    Custom -->|No| GetErrors[GetErrors: read IDataErrorInfo]
    PerformValidation --> HasErrors{Errors found?}
    GetErrors --> HasErrors
    HasErrors -->|Yes| MarkInvalid[Mark invalid, add unique errors, format error CSS]
    HasErrors -->|No| FormatValid[Format valid CSS unless first-error control]
    MarkInvalid --> More{More binders?}
    FormatValid --> More
    More -->|Yes| IterateBinders
    More -->|No| WriteLabel[Write aggregated errors to ErrorLabel/SAIFMessage]
    WriteLabel --> EndResult([Return overall valid/invalid])

Failure and edge-case behavior

  • A distinct bound object with no IsValid property is skipped without error during ValidateBindSources().*
  • Error text containing <BR> tags is stripped before being added to the aggregated error collection.

Sources

  • SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBindManager.vb
  • SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBinderbase.vb