Validate a control and surface errors¶
This operation reads the bound object's IDataErrorInfo error text for the bound property, writes it to the page's error label, and styles the control to reflect its validity.
| Field | Value |
|---|---|
| Operation ID | OP-AJAX-04 |
| Trigger | Called from bind (OP-AJAX-02) or edit (OP-AJAX-03) operations, or invoked directly |
| Inputs | BoundObject (IDataErrorInfo), BindProperty |
| Outputs | Page's LblErrorMsg label text set; control styled |
| Primary components | AutoBindControlAncestor.Validate, GetErrorMessages, StyleControl |
| Entry point | SAIF.Presentation.Web.Controls.AJAX.Infragistics111/AutoBindControlAncestor.vb |
Steps¶
- Read
ErrorMessages, which callsGetErrorMessages: if the control is bound, castBoundObjecttoIDataErrorInfo, readItem(BindProperty), and split the text on CRLF; if unbound, return an empty array. (BR-AJAX-008, BR-AJAX-009) - Concatenate the distinct messages with
<br>separators, skipping any message already present in the accumulated string. (BR-AJAX-010) - Locate the page's
LblErrorMsglabel by recursiveUniqueIDsearch (case-insensitive) and set itsTextto the assembled message viaBindingUtility.SetObjectValue. (BR-AJAX-011) - Call
StyleControl(IsValid); each concrete control paints the editor red when invalid and resets the background otherwise. (BR-AJAX-012) - Always return
True— the return value does not report validity.*
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Validate called]) --> Bound{Control bound?}
Bound -->|No| Empty([No error messages])
Bound -->|Yes| Read[Read IDataErrorInfo.Item BindProperty]
Read --> Split[Split on CRLF, dedupe, join with br]
Split --> Locate[Locate LblErrorMsg by UniqueID search]
Locate --> SetText[Set label Text]
SetText --> Style[StyleControl IsValid]
Style --> EndOk([Return True])
Failure and edge-case behavior¶
- An unbound control reports no errors and is treated as valid. (BR-AJAX-009)
- The method always returns
Trueregardless of actual validity; no caller in this repository appears to use the return value.*
Related documentation¶
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.
Sources¶
SAIF.Presentation.Web.Controls.AJAX.Infragistics111/AutoBindControlAncestor.vb