---
title: Highlight grid rows/cells with broken business rules
summary: Visually flags grid cells bound to properties with broken BOF business rules after a save/validate attempt.
status: draft
owner: SAIF Documentation Team
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Core.Infragistics103
reference_type: package
operation_id: OP-AVPB-003
trigger: Explicit call to AppViewPageBase.SetErrorColorInGrid after a save/validate action
---

# 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](../business-rules.md#br-avpb-002-broken-business-rules-are-visually-flagged-on-their-bound-grid-cell).
   - On failure: the cell lookup is wrapped in `Try/Catch` and silently skipped (e.g., column not present in the grid).
3. On the first error found, if `inSetFocusOnFirstError` is `True`, sets `Behaviors.Activation.ActiveCell` to that cell.
4. 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.

```mermaid
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.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [API reference](../api/index.md)

## Sources
- SAIF.Presentation.Web.Core.Infragistics103\AppViewPageBase.aspx.vb
