Skip to content

Highlight grid rows/cells with broken business rules

This operation renders the outcome of BOF business-object validation onto a data-bound WebDataGrid, visually flagging cells whose bound property has a broken business rule.

Field Value
Operation ID OP-AVPB-003
Trigger Called by consuming page code after a save/validate attempt on a data-bound WebDataGrid
Inputs The grid (WebDataGrid), inSetFocusOnFirstError flag
Outputs Boolean (whether any error was found), CSS/focus side effects
Primary components AppViewPageBase.SetErrorColorInGrid
Entry point SAIF.Presentation.Web.Core.Infragistics103\AppViewPageBase.aspx.vb

Steps

  1. Iterates every GridRecord in the grid; casts DataItem to clsBusinessBase (BOF business object).
  2. If the cast succeeds and myObject.IsValid is False, iterates myObject.Rules.BrokenRules and, for each broken rule, appends the CSS class "wgcerror" to the grid cell whose column key matches the broken rule's PropertyName — enforces BR-AVPB-002.
  3. On failure: the cell lookup is wrapped in Try/Catch and silently skipped (e.g., column not present in the grid).
  4. On the first error found, if inSetFocusOnFirstError is True, sets Behaviors.Activation.ActiveCell to that cell.
  5. Returns True if no error was ever found (i.e., firstError remained True); otherwise False.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([SetErrorColorInGrid called]) --> S1[Iterate GridRecords]
    S1 --> S2{DataItem is clsBusinessBase and IsValid = False?}
    S2 -->|No| Next[Continue to next record]
    S2 -->|Yes| S3[Iterate Rules.BrokenRules]
    S3 --> S4[Append wgcerror CSS to matching cell]
    S4 --> D1{First error and inSetFocusOnFirstError?}
    D1 -->|Yes| S5[Set ActiveCell to error cell]
    D1 -->|No| Next
    Next --> EndReturn([Return True if no errors found, else False])

Failure and edge-case behavior

  • A column lookup failure for a given rule is silently skipped via Try/Catch.
  • This operation consumes BOF validation results (IsValid, Rules.BrokenRules) produced elsewhere (in the business-object layer, out of scope here) but does not itself define or evaluate business rules — it only renders their outcome.

Sources

  • SAIF.Presentation.Web.Core.Infragistics103\AppViewPageBase.aspx.vb