---
title: Build and fill the conditions grid
summary: Provide a pre-built, reusable grid panel for displaying medical-conditions-shaped data.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2
reference_type: package
operation_id: OP-V2-008
trigger: "`CreateChildControls` on first use; `Fill` when the host page has a `CollectionBase` to display; `OnPreRender` on every render."
---

# Build and fill the conditions grid

Provide a pre-built, reusable grid panel for displaying medical-conditions-shaped data. `CreateChildControls` on first use; `Fill` when the host page has a `CollectionBase` to display; `OnPreRender` on every render.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-V2-008 |
| **Trigger** | `CreateChildControls` on first use; `Fill` when the host page has a `CollectionBase` to display; `OnPreRender` on every render. |
| **Inputs** | Caller-supplied `System.Collections.CollectionBase`. |
| **Outputs** | A `SAIFPanel`-hosted, explicitly-columned `GridView` titled "Medical Conditions". |
| **Primary components** | `ConditionsGrid` |
| **Entry point** | `SAIF.Presentation.Web.Controls.V2/ConditionsGrid.vb` |

## Steps

1. On `CreateChildControls`, when the control has no children, create a `SAIFPanel` named `pnlConditions` titled `Medical Conditions`, containing an auto-scrolling `Panel` and a `GridView` (`dgConditions`) with SAIF CSS classes and explicit columns, sized 23 pixels narrower than the control. ([BR-V2-052](../business-rules.md#br-v2-052-conditions-grid-always-titled-and-panel-hosted), [BR-V2-053](../business-rules.md#br-v2-053-grid-columns-are-never-auto-generated))
   - > **Origin**: The panel is built with [`SAIFPanel`](collapse-expand-panel.md) (this library, `OP-V2-007`).
2. `Fill(inDataSource As CollectionBase)` locates the panel and grid, assigns the supplied collection as the grid data source, data-binds and sorts it. ([BR-V2-054](../business-rules.md#br-v2-054-conditions-grid-fill-sorts-the-caller-supplied-collection))
   - The caller supplies an already-materialized business collection; the control performs no data access.
3. On `OnPreRender`, overwrite the grid's `ID` attribute with the fully qualified `ClientID_panelID_gridID` so the jQuery script can find it, and set the scroll panel height to 110 pixels when the grid has four or more rows. ([BR-V2-055](../business-rules.md#br-v2-055-grid-id-rewritten-for-jquery-compatibility), [BR-V2-056](../business-rules.md#br-v2-056-scroll-region-capped-once-the-grid-has-four-or-more-rows))
4. Both `CreateChildControls` and `Fill` wrap their bodies in a `Try`/`Catch` block with empty catch handlers. ([BR-V2-057](../business-rules.md#br-v2-057-construction-and-fill-failures-are-swallowed-silently))
   - On failure: the exception is swallowed silently; no error is surfaced to the host page or log.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([CreateChildControls]) --> Empty{No children yet?}
	Empty -->|Yes| Build[Build SAIFPanel + GridView with explicit columns]
	Empty -->|No| Skip[Skip rebuild]
	Build --> FillCall([Host calls Fill])
	Skip --> FillCall
	FillCall --> Bind[Assign data source, DataBind, Sort]
	Bind --> Pre[OnPreRender: rewrite ID, size scroll region]
	Pre --> Done([Rendered])
```

## Failure and edge-case behavior

- On failure: the exception is swallowed silently; no error is surfaced to the host page or log.

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

> **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.V2/ConditionsGrid.vb`
