---
title: SAIFGrid
summary: API reference for SAIFGrid.
status: draft
owner: SAIF Documentation Team
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.V2
reference_type: package
---

# SAIFGrid

`SAIFGrid` is a `GridView` subclass adding client-side sortable-table wiring (via the `tablesorter` jQuery plugin, registered through `SAIF.Grid.js`), zebra-row styling, row-click event delegation to a caller-supplied JavaScript handler, and accessible `<thead>`/`<tbody>` markup.

## Purpose
- Give grids a consistent client-side sorting and zebra-striping experience without requiring each page to write its own jQuery wiring.
- Let host pages respond to row clicks via a named client-side function, keyed off a configurable data field, rather than wiring `GridView` row-command logic themselves.
- Improve accessibility by rendering a proper `<thead>` section for the header row.

## Context
- Namespace: `SAIF.Presentation.Web.Controls.V2`
- Assembly/package: Compiled into `SAIF.BOF.Presentation.Web.Infragistics103`*

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `DataKeyField` | `Public Property DataKeyField As String` | Names the bound data source field whose value is attached to each row (`dataKeyField` attribute) and passed to the row-click handler; if blank, the row-click event is not raised even when `RaiseRowClickEvent` is true. |
| `RaiseRowClickEvent` | `Public Property RaiseRowClickEvent As Boolean` | Enables client-side row-click event dispatch to `RowClickEventHandler`. |
| `RowClickEventHandler` | `Public Property RowClickEventHandler As String` | Names the client-side JavaScript function (signature `function handleRowClick(val)`) invoked with the clicked row's `DataKeyField` value; requires `RaiseRowClickEvent = True`. |
| `UseZebraRows` | `Public Property UseZebraRows As Boolean` | Enables alternating-row (zebra) styling via the `tablesorter` widget; defaults to `True`. |
| `New()` | `Public Sub New()` | Sets the base `CssClass` to `"SAIFGrid"`. |

## Inherited public members

`SAIFGrid` inherits from `GridView` (`System.Web.UI.WebControls`), a framework base class rather than a documented SAIF dependency library.

| Member | Signature | Purpose |
| --- | --- | --- |
| `AutoGenerateColumns` | `Public Property AutoGenerateColumns As Boolean` | Controls whether columns are generated automatically from the bound data source. |
| `Columns` | `Public ReadOnly Property Columns As DataControlFieldCollection` | Declarative and programmatic column definitions rendered by the grid. |
| `DataKeyNames` | `Public Property DataKeyNames As String()` | Field names whose values are retained as per-row keys across postbacks. |
| `DataSource` | `Public Property DataSource As Object` | Data collection used to populate the grid's rows during binding. |
| `EmptyDataText` | `Public Property EmptyDataText As String` | Text shown when the bound data source contains no rows. |
| `PageIndex` | `Public Property PageIndex As Integer` | Current page index when paging is enabled. |
| `PageSize` | `Public Property PageSize As Integer` | Number of rows rendered per page when paging is enabled. |
| `Rows` | `Public ReadOnly Property Rows As GridViewRowCollection` | Rendered data rows available after binding. |
| `SelectedIndex` | `Public Property SelectedIndex As Integer` | Index of the currently selected row when selection is enabled. |
| `SortExpression` | `Public Property SortExpression As String` | Current sort field used by the grid's built-in sorting model. |
| `DataBind()` | `Public Overrides Sub DataBind()` | Binds the current data source and rebuilds the grid rows. |
| `RowDataBound` | `Public Event RowDataBound As GridViewRowEventHandler` | Raised as each row is bound so callers can customize output. |

Standard `GridView`/`Control` members (`ID`, `ClientID`, `Controls`, `Visible`, `DataBind`, `FindControl`, etc.) are not re-documented here as they are unmodified framework behavior**.

## Behavioral notes
- `SAIFGrid_PreRender` sets `UseAccessibleHeader = True` and moves the header row into `TableRowSection.TableHeader` whenever the grid has rows, producing a proper `<thead>`.
- `SAIFGrid_RowDataBound` reads the configured `DataKeyField` from each bound data row via reflection and attaches its value as a `dataKeyField` HTML attribute.
- `RegisterClientScripts`/`GetScript` register `SAIF.Grid.js` and an inline startup script that initializes `tablesorter`, adds hover styling to header cells, and wires the row-click handler when configured.

## Constraints and usage notes
- Requires `SAIF.Grid.js` to be deployed at `/Resources/Scripts/SAIF.Grid.js` for the sorting/zebra/row-click behavior to function.
- `RowClickEventHandler` must be the literal name of a client-side function already defined on the page; no validation of its existence is performed server-side.


> **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\SAIFGrid.vb
