Skip to content

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

  1. Read ErrorMessages, which calls GetErrorMessages: if the control is bound, cast BoundObject to IDataErrorInfo, read Item(BindProperty), and split the text on CRLF; if unbound, return an empty array. (BR-AJAX-008, BR-AJAX-009)
  2. Concatenate the distinct messages with <br> separators, skipping any message already present in the accumulated string. (BR-AJAX-010)
  3. Locate the page's LblErrorMsg label by recursive UniqueID search (case-insensitive) and set its Text to the assembled message via BindingUtility.SetObjectValue. (BR-AJAX-011)
  4. Call StyleControl(IsValid); each concrete control paints the editor red when invalid and resets the background otherwise. (BR-AJAX-012)
  5. 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 True regardless of actual validity; no caller in this repository appears to use the return value.*

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