Skip to content

Validate a grid collection

Validate every row (and hierarchical child row) of a bound grid collection and highlight invalid cells.

Field Value
Operation ID OP-BIND-006
Trigger Validate() reaching a grid binder
Inputs The bound collection, the grid's bands and columns
Outputs Cell-level red highlighting, collected error messages, activated first invalid cell
Primary components clsUltraGridBinder.GetErrors, ResetControlFormatting, ResetRows, ValidateObject, GetGridRow (and the equivalents in clsWebDataGridBinder / clsWebHierarchicalDataGridBinder)
Entry point SAIF.Presentation.Web.Binding.Infragistics111/InfragisticsClassicControls/clsUltraGridBinder.vb

Steps

  1. Reset the binder's error flag and re-apply each cell's normal background — the band's RowAlternateStyle.BackColor for alternate rows and RowStyle.BackColor otherwise — recursing into child rows. (BR-BIND-044)
  2. Cast the bound collection to IDataErrorInfo and read its Error property; when non-empty, split it on CRLF, strip <BR>, and add each fragment as a collection-level error, then return. (BR-BIND-045)
  3. On failure: a cast failure is caught and ignored so that non-IDataErrorInfo sources fall through to per-object validation (BR-BIND-046).
  4. For each object in the collection and each band of the grid, build the band's column-key list. For band index 0 validate the object itself; for deeper bands resolve the child collection named by Band.BaseTableName from the parent object and validate each child. (BR-BIND-047)
  5. ValidateObject casts the object to IDataErrorInfo and reads Item(columnKey) for every column key — that is, grid column keys are treated as business object property names. (BR-BIND-048)
  6. On failure: any exception in ValidateObject is swallowed so that objects not implementing IDataErrorInfo are skipped rather than failing the page (BR-BIND-046).
  7. Non-empty error text marks the column invalid and its split fragments are added to ControlErrors. (BR-BIND-032)
  8. Resolve the grid row for the object using the configured key property (or, for hierarchical grids, the band-specific key from HierarchialGridArgs.GetKeyProperty). (BR-BIND-049)
  9. Set every invalid cell's Style.BackColor to Color.Red and Activate() the first invalid cell only. (BR-BIND-050)

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Validate reaches grid binder]) --> S1[Reset cell formatting]
    S1 --> D1{Collection implements IDataErrorInfo.Error?}
    D1 -->|Yes, non-empty| S2[Add collection-level error and return]
    D1 -->|No / empty| S3[For each object and band: validate columns]
    S3 --> D2{Object implements IDataErrorInfo?}
    D2 -->|No| Skip[Skip silently]
    D2 -->|Yes| S4[Read Item columnKey per column]
    S4 --> S5[Mark invalid cells red]
    S5 --> S6[Activate first invalid cell]
    S6 --> End([Grid validation complete])
    Skip --> End

Failure and edge-case behavior

  • Objects that do not implement IDataErrorInfo are skipped silently rather than raising an error, so mixed collections do not break the page (BR-BIND-046).

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. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service.

Sources

  • SAIF.Presentation.Web.Binding.Infragistics111/InfragisticsClassicControls/clsUltraGridBinder.vb