---
title: Customize and apply grid column visibility and paging
summary: Lets end users show/hide UltraWebGrid columns and control paging via a modal popup, with optional persisted preferences.
status: draft
owner: SAIF documentation generator
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.Controls.AJAX.Infragistics103
reference_type: package
operation_id: OP-AJAX-006
trigger: Page load (initial grid render) and end-user interaction with the modal popup (OK / Set-as-default buttons)
---

# Customize and apply grid column visibility and paging

This composite operation spans `ModalGridCustomizer_Load`, `GridCustomizationPanel.OKClicked`, and `InfragisticsGridCustomizer.Update`/`ManipulateGrid`/`SavePreferences`. It lets end users show/hide `UltraWebGrid` columns and control grid paging through a modal popup, optionally persisting their choices to a per-user preference store (`clsPreferences`).

| Field | Value |
| --- | --- |
| **Operation ID** | OP-AJAX-006 |
| **Trigger** | Page load (initial grid render); end-user clicks OK or "Set as Default" in the modal popup |
| **Inputs** | Target `UltraWebGrid` reference (`TargetControls.GridId`), the model's `GridCustomizers` collection, `clsPreferences` store |
| **Outputs** | Mutated grid column/paging configuration; optionally persisted user preferences |
| **Primary components** | `ModalGridCustomizer.ModalGridCustomizer_Load`, `GridCustomizationPanel.OKClicked`, `InfragisticsGridCustomizer.Update`, `InfragisticsGridCustomizer.ManipulateGrid`, `InfragisticsGridCustomizer.SavePreferences` |
| **Entry point** | `SAIF.Presentation.Web.Controls.AJAX.Infragistics103\ModalGridCustomizer.vb` |

## Steps

1. **Initial load** (`ModalGridCustomizer_Load`, handles `Me.Load`): if not a postback, resolves/creates the `InfragisticsGridCustomizer` for the target grid (`GridCustomizer` property — looks up an existing customizer by grid ID in the model's `GridCustomizers` list, or constructs a new one from the grid's current column set plus any saved column-selection/page-size preferences read from `clsPreferences` via keys `IGC_{GridId}_ColumnSelection`/`IGC_{GridId}_PageSize`), then calls `GridCustomizer.ManipulateGrid(TargetGrid)` to insert/remove `UltraGridColumn`s from the grid's `Columns` collection based on stored visibility ([BR-AJAX-002](../business-rules.md#br-ajax-002-always-visible-and-always-hidden-grid-columns-cannot-be-toggled-by-the-end-user)), and (if `ControlPaging`) sets `inGrid.DisplayLayout.Pager.AllowPaging = True`/`PageSize`.
   - On failure: `InfragisticsGridCustomizer` construction throws `ApplicationException` if an always-visible/always-hidden column key does not exist on the target grid ([BR-AJAX-003](../business-rules.md#br-ajax-003-grid-column-visibility-override-keys-must-exist-on-the-target-grid)).
2. **Popup rendering** (`CustomizationPanel_AfterRender`): initializes `GridCustomizationPanel` with the customizer's `ListItems` (checkbox list of columns, respecting [BR-AJAX-002](../business-rules.md#br-ajax-002-always-visible-and-always-hidden-grid-columns-cannot-be-toggled-by-the-end-user)) and current `PageSize`, and wires the `ModalPopupExtender`'s target/popup/cancel/OK control IDs.
3. **User clicks OK** (`GridCustomizationPanel.OKClicked`, handles `m_OKButton.Click`): raises `OKButtonClicked` and `BindGrid` events on the panel.
4. `ModalGridCustomizer.CustomizationPanel_OKButtonClicked` (handles the panel's `OKButtonClicked`): calls `GridCustomizer.Update(checkboxListItems, pageSize)` — updates in-memory `HidableInfragisticsColumn.IsVisible` flags and `PageSize` (only for columns whose `VisibilityMode = Normal`; `AlwaysVisible`/`AlwaysHidden` columns are immune, per [BR-AJAX-002](../business-rules.md#br-ajax-002-always-visible-and-always-hidden-grid-columns-cannot-be-toggled-by-the-end-user)) — then re-calls `ManipulateGrid(TargetGrid)` to apply the new visibility/paging to the live grid.
5. `ModalGridCustomizer.CustomizationPanel_BindGrid` (handles the panel's `BindGrid` event): rebinds the grid per `BindingBehavior` — `ObjectBinder` (calls `inObjectBinder.ObjectToControl(inGrid)` via `clsObjectBindManager`), `DataBind` (calls `inGrid.DataBind()`), or `Custom` (re-raises a `BindGrid` event for page code-behind to handle).
   - `ObjectBinder` property getter throws `ApplicationException` if the named binder control cannot be found via `Page.FindControl`.
6. **User clicks "Set as Default"** (`GridCustomizationPanel.SetAsDefaultButton_Click`, handles `m_SetAsDefaultButton.Click`): raises `OnSavePreferences`; `ModalGridCustomizer.CustomizationPanel_SavePreferences` handles it by calling `GridCustomizer.Update(checkboxListItems, pageSize)` then `GridCustomizer.SavePreferences(TargetGrid, listItems, pageSize)`, which serializes the current `ListItems` into a delimited string via `ColumnPreferenceList` and stores it under the `IGC_{GridId}_ColumnSelection`/`IGC_{GridId}_PageSize` keys in `clsPreferences`, then calls `Preferences.Save()`.
   - `Preferences.Save()` and the `clsPreferences` indexer are provided by a referenced framework/business type (inferred `SAIF.Framework.Preferences`**); its own persistence mechanism (e.g., database vs. session) is not traced in this project's source and was not retrievable from this library alone.

   > **Origin**: The `clsPreferences` persistence mechanism referenced in step 6 is implemented in `SAIF.Framework.Preferences`**, not this library — its internal storage behavior is out of scope for this analysis.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Load([Page load, not postback]) --> Resolve[Resolve or create InfragisticsGridCustomizer]
	Resolve --> Manip1[ManipulateGrid applies stored column visibility/paging]
	Manip1 --> Popup[CustomizationPanel_AfterRender initializes checkbox list]
	Popup --> UserAction{User action}
	UserAction -->|Click OK| Update[GridCustomizer.Update sets IsVisible/PageSize]
	Update --> Manip2[ManipulateGrid re-applies to live grid]
	Manip2 --> BindGrid[CustomizationPanel_BindGrid rebinds per BindingBehavior]
	UserAction -->|Set as Default| Update2[GridCustomizer.Update]
	Update2 --> Save[SavePreferences writes to clsPreferences and saves]
```

## Failure and edge-case behavior
- `TargetGrid`/`ObjectBinder` property getters throw `ApplicationException` if the named grid/binder control cannot be resolved via `Page.FindControl`.
- `ValidateColumnVisibilitySettings` throws `ApplicationException` if an always-visible/always-hidden column key does not exist on the target grid, per [BR-AJAX-003](../business-rules.md#br-ajax-003-grid-column-visibility-override-keys-must-exist-on-the-target-grid).
- If a previously-preferenced column was removed from or renamed in the grid, `LoadColumnPreferences` skips it silently rather than failing.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.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.AJAX.Infragistics103\ModalGridCustomizer.vb`
- `SAIF.Presentation.Web.Controls.AJAX.Infragistics103\InfragisticsGridCustomizer.vb`
- `SAIF.Presentation.Web.Controls.AJAX.Infragistics103\GridCustomizationPanel.vb`
