Column sets
GridControlGive one grid a different column set per task, switched at runtime.
Overview
Column sets let one Blazor GridControl show different columns for different jobs, swapped at runtime from a list of column specs kept in C#. Use them when a purchasing view and a short summary share the same booking lines: wrap the swap in SuspendRedraw and the grid changes its columns in place, keeping its data and the selected row. Each column is a GridColumn inside an @foreach, keyed by its field.
Examples
#Three column sets, one grid
Select a row, then switch between the Default, Purchasing and Minimal sets: the selection survives, the Purchasing set carries a hidden Category column, and Qty and Price stay editable.
| Item Code | Description | Category | Qty | Price | Total |
|---|---|---|---|---|---|
| HT-110 | Hotel, double room per night | Hotels | 14 | 145.00 | 2030.00 |
| FL-210 | Return flight, economy | Flights | 24 | 189.00 | 4536.00 |
| TF-310 | Airport transfer, shuttle bus | Transfers | 2 | 320.00 | 640.00 |
| TR-410 | Sintra palaces day tour | Tours | 24 | 68.50 | 1644.00 |
| IN-510 | Group travel insurance | Insurance | 24 | 34.50 | 828.00 |
| RL-610 | Rail pass, Lisbon to Porto | Rail | 24 | 42.00 | 1008.00 |
Default set: 6 of 6 columns visible
Documentation
The core GridColumn parameters, the container they register with, the column-set methods this page calls and the
selection events it wires. The editing parameters (EditTemplate, EditOptions, the edit button and
their relatives) are on Batch editing; Field, Type and
Format in depth on Dynamic columns; SelectionSettings, the
selection methods and GridSelectionChangedArgs on Master-detail. A set
switch here is host state: the @foreach inside GridColumnsBase runs over _currentColumns,
each column keyed by its Field, and the assignment sits inside SuspendRedraw(fields), which pairs
BeginUpdate() with EndUpdateAsync(order).