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¶
- Call
BindToObject()to sync non-event-driven controls into their objects (see Control to object data pull). - Clear
m_Errorsand resetm_FirstErrorControl. - (
Validate()only) Call the privateValidateBindSources(): for each distinct object inm_ValidationObjects, reflectively read itsIsValidproperty 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.* - Iterate
m_Bindings: for each binder, callPerformValidation()ifIsCustomValidatoris true (custom validator delegate/Object-modeIsValidcheck), else callGetErrors()(readsIDataErrorInfo.Item(property)on the bound/validation object, splits onvbCrLf, strips<BR>tags, populatesControlErrors). - If the binder has errors:
- Mark the overall result invalid.
- Add unique error strings to
m_Errors(BR-BIND-005). - Record
m_FirstErrorControlif not already set. - Call
Binder.SetControlFormat(False)— applieserrorbackcolor/errorbordercolorCSS, skipping grids/checkbox-lists (BR-BIND-002) and varying byTextBox.MultiLinestate (BR-BIND-003). - If the binder has no errors, apply valid CSS via
SetControlFormat(True)(BR-BIND-001), unless the binder's control is the same asm_FirstErrorControl(BR-BIND-004). - If
ErrorLabelis set, writeFormattedErrorMessage(all unique errors joined with<BR>) to it; likewise forSAIFMessageif set. - Return the overall boolean result.
RefreshValidation()follows the identical sequence but omits step 3 (ValidateBindSources()), per its stated purpose of refreshing control formatting without re-validating bind sources.- No SQL/table interaction occurs; no delegation into a referenced-library operation beyond invoking the bound business object's own
IDataErrorInfo/IsValidmembers (defined inSAIF.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
IsValidproperty is skipped without error duringValidateBindSources().* - Error text containing
<BR>tags is stripped before being added to the aggregated error collection.
Related documentation¶
Sources¶
SAIF.Presentation.Web.Binding.Infragistics103\clsObjectBindManager.vbSAIF.Presentation.Web.Binding.Infragistics103\clsObjectBinderbase.vb