Dynamic columns
GridControlLet the data decide the columns: read them from the rows or from attributes.
Overview
Dynamic columns let a Blazor GridControl take its columns from the data instead of from markup you write by hand. Use dictionary rows such as ExpandoObject for imports or query results whose fields vary, since each key can become a column; or set AutoGenerateColumns and let data-annotation attributes on the row type supply headers, order, bands, formats and read-only cells.
Examples
#Columns read from the first row
Turn the lead-time field on and off to add and remove a column, or change the row count; the columns are read from the keys of the first row and swapped inside SuspendRedraw.
| Code | Description | Group | Status | Rate |
|---|---|---|---|---|
| IT-1001 | Catalog item 1, hotels | Hotels | Active | 134.91 |
| IT-1002 | Catalog item 2, tours | Tours | Active | 258.84 |
| IT-1003 | Catalog item 3, transfers | Transfers | Active | 73.09 |
| IT-1004 | Catalog item 4, insurance | Insurance | Pending | 94.38 |
| IT-1005 | Catalog item 5, flights | Flights | Active | 29.44 |
| IT-1006 | Catalog item 6, hotels | Hotels | Active | 175.82 |
| IT-1007 | Catalog item 7, tours | Tours | Active | 157.29 |
| IT-1008 | Catalog item 8, transfers | Transfers | Pending | 28.71 |
| IT-1009 | Catalog item 9, insurance | Insurance | Active | 215.49 |
| IT-1010 | Catalog item 10, flights | Flights | Active | 158.75 |
| IT-1011 | Catalog item 11, hotels | Hotels | Active | 223.02 |
| IT-1012 | Catalog item 12, tours | Tours | Pending | 121.65 |
| IT-1013 | Catalog item 13, transfers | Transfers | Active | 130.62 |
| IT-1014 | Catalog item 14, insurance | Insurance | Active | 40.89 |
| IT-1015 | Catalog item 15, flights | Flights | Active | 140.15 |
| IT-1016 | Catalog item 16, hotels | Hotels | Pending | 114.75 |
| IT-1017 | Catalog item 17, tours | Tours | Active | 265.53 |
| IT-1018 | Catalog item 18, transfers | Transfers | Active | 43.83 |
| IT-1019 | Catalog item 19, insurance | Insurance | Active | 61.51 |
| IT-1020 | Catalog item 20, flights | Flights | Pending | 172.72 |
| IT-1021 | Catalog item 21, hotels | Hotels | Active | 51.20 |
| IT-1022 | Catalog item 22, tours | Tours | Active | 105.39 |
| IT-1023 | Catalog item 23, transfers | Transfers | Active | 91.79 |
| IT-1024 | Catalog item 24, insurance | Insurance | Pending | 81.66 |
| IT-1025 | Catalog item 25, flights | Flights | Active | 42.56 |
| IT-1026 | Catalog item 26, hotels | Hotels | Active | 245.34 |
| IT-1027 | Catalog item 27, tours | Tours | Active | 75.27 |
| IT-1028 | Catalog item 28, transfers | Transfers | Pending | 211.51 |
| IT-1029 | Catalog item 29, insurance | Insurance | Active | 204.63 |
| IT-1030 | Catalog item 30, flights | Flights | Active | 113.97 |
| IT-1031 | Catalog item 31, hotels | Hotels | Active | 142.98 |
| IT-1032 | Catalog item 32, tours | Tours | Pending | 255.18 |
| IT-1033 | Catalog item 33, transfers | Transfers | Active | 123.50 |
| IT-1034 | Catalog item 34, insurance | Insurance | Active | 111.86 |
| IT-1035 | Catalog item 35, flights | Flights | Active | 231.88 |
| IT-1036 | Catalog item 36, hotels | Hotels | Pending | 56.64 |
| IT-1037 | Catalog item 37, tours | Tours | Active | 167.40 |
| IT-1038 | Catalog item 38, transfers | Transfers | Active | 235.86 |
| IT-1039 | Catalog item 39, insurance | Insurance | Active | 210.50 |
| IT-1040 | Catalog item 40, flights | Flights | Pending | 66.66 |
| IT-1041 | Catalog item 41, hotels | Hotels | Active | 202.10 |
| IT-1042 | Catalog item 42, tours | Tours | Active | 269.07 |
| IT-1043 | Catalog item 43, transfers | Transfers | Active | 166.76 |
| IT-1044 | Catalog item 44, insurance | Insurance | Pending | 144.37 |
| IT-1045 | Catalog item 45, flights | Flights | Active | 246.27 |
| IT-1046 | Catalog item 46, hotels | Hotels | Active | 77.49 |
| IT-1047 | Catalog item 47, tours | Tours | Active | 32.33 |
| IT-1048 | Catalog item 48, transfers | Transfers | Pending | 99.71 |
| IT-1049 | Catalog item 49, insurance | Insurance | Active | 149.99 |
| IT-1050 | Catalog item 50, flights | Flights | Active | 142.66 |
| IT-1051 | Catalog item 51, hotels | Hotels | Active | 219.98 |
| IT-1052 | Catalog item 52, tours | Tours | Pending | 146.81 |
| IT-1053 | Catalog item 53, transfers | Transfers | Active | 167.87 |
| IT-1054 | Catalog item 54, insurance | Insurance | Active | 193.24 |
| IT-1055 | Catalog item 55, flights | Flights | Active | 71.89 |
| IT-1056 | Catalog item 56, hotels | Hotels | Pending | 49.52 |
| IT-1057 | Catalog item 57, tours | Tours | Active | 187.04 |
| IT-1058 | Catalog item 58, transfers | Transfers | Active | 261.43 |
| IT-1059 | Catalog item 59, insurance | Insurance | Active | 71.82 |
| IT-1060 | Catalog item 60, flights | Flights | Pending | 54.10 |
| IT-1061 | Catalog item 61, hotels | Hotels | Active | 120.54 |
| IT-1062 | Catalog item 62, tours | Tours | Active | 215.77 |
| IT-1063 | Catalog item 63, transfers | Transfers | Active | 94.07 |
| IT-1064 | Catalog item 64, insurance | Insurance | Pending | 121.52 |
| IT-1065 | Catalog item 65, flights | Flights | Active | 35.78 |
| IT-1066 | Catalog item 66, hotels | Hotels | Active | 237.85 |
| IT-1067 | Catalog item 67, tours | Tours | Active | 268.15 |
| IT-1068 | Catalog item 68, transfers | Transfers | Pending | 38.76 |
| IT-1069 | Catalog item 69, insurance | Insurance | Active | 79.01 |
| IT-1070 | Catalog item 70, flights | Flights | Active | 103.51 |
| IT-1071 | Catalog item 71, hotels | Hotels | Active | 217.35 |
| IT-1072 | Catalog item 72, tours | Tours | Pending | 49.67 |
| IT-1073 | Catalog item 73, transfers | Transfers | Active | 103.33 |
| IT-1074 | Catalog item 74, insurance | Insurance | Active | 264.86 |
| IT-1075 | Catalog item 75, flights | Flights | Active | 240.61 |
| IT-1076 | Catalog item 76, hotels | Hotels | Pending | 52.13 |
| IT-1077 | Catalog item 77, tours | Tours | Active | 208.64 |
| IT-1078 | Catalog item 78, transfers | Transfers | Active | 217.43 |
| IT-1079 | Catalog item 79, insurance | Insurance | Active | 105.39 |
| IT-1080 | Catalog item 80, flights | Flights | Pending | 235.07 |
| IT-1081 | Catalog item 81, hotels | Hotels | Active | 233.00 |
| IT-1082 | Catalog item 82, tours | Tours | Active | 245.56 |
| IT-1083 | Catalog item 83, transfers | Transfers | Active | 81.52 |
| IT-1084 | Catalog item 84, insurance | Insurance | Pending | 81.98 |
| IT-1085 | Catalog item 85, flights | Flights | Active | 163.99 |
| IT-1086 | Catalog item 86, hotels | Hotels | Active | 266.16 |
| IT-1087 | Catalog item 87, tours | Tours | Active | 107.30 |
| IT-1088 | Catalog item 88, transfers | Transfers | Pending | 200.26 |
| IT-1089 | Catalog item 89, insurance | Insurance | Active | 59.97 |
| IT-1090 | Catalog item 90, flights | Flights | Active | 202.36 |
| IT-1091 | Catalog item 91, hotels | Hotels | Active | 139.60 |
| IT-1092 | Catalog item 92, tours | Tours | Pending | 175.97 |
| IT-1093 | Catalog item 93, transfers | Transfers | Active | 184.04 |
| IT-1094 | Catalog item 94, insurance | Insurance | Active | 176.40 |
| IT-1095 | Catalog item 95, flights | Flights | Active | 216.11 |
| IT-1096 | Catalog item 96, hotels | Hotels | Pending | 256.33 |
| IT-1097 | Catalog item 97, tours | Tours | Active | 195.00 |
| IT-1098 | Catalog item 98, transfers | Transfers | Active | 65.24 |
| IT-1099 | Catalog item 99, insurance | Insurance | Active | 128.59 |
| IT-1100 | Catalog item 100, flights | Flights | Pending | 28.42 |
| IT-1101 | Catalog item 101, hotels | Hotels | Active | 79.34 |
| IT-1102 | Catalog item 102, tours | Tours | Active | 263.57 |
| IT-1103 | Catalog item 103, transfers | Transfers | Active | 40.70 |
| IT-1104 | Catalog item 104, insurance | Insurance | Pending | 66.48 |
| IT-1105 | Catalog item 105, flights | Flights | Active | 195.30 |
| IT-1106 | Catalog item 106, hotels | Hotels | Active | 190.31 |
| IT-1107 | Catalog item 107, tours | Tours | Active | 63.48 |
| IT-1108 | Catalog item 108, transfers | Transfers | Pending | 173.02 |
| IT-1109 | Catalog item 109, insurance | Insurance | Active | 222.62 |
| IT-1110 | Catalog item 110, flights | Flights | Active | 39.76 |
| IT-1111 | Catalog item 111, hotels | Hotels | Active | 110.88 |
| IT-1112 | Catalog item 112, tours | Tours | Pending | 239.62 |
| IT-1113 | Catalog item 113, transfers | Transfers | Active | 176.04 |
| IT-1114 | Catalog item 114, insurance | Insurance | Active | 106.74 |
| IT-1115 | Catalog item 115, flights | Flights | Active | 91.10 |
| IT-1116 | Catalog item 116, hotels | Hotels | Pending | 144.98 |
| IT-1117 | Catalog item 117, tours | Tours | Active | 154.25 |
| IT-1118 | Catalog item 118, transfers | Transfers | Active | 32.10 |
| IT-1119 | Catalog item 119, insurance | Insurance | Active | 227.53 |
| IT-1120 | Catalog item 120, flights | Flights | Pending | 39.62 |
| IT-1121 | Catalog item 121, hotels | Hotels | Active | 150.54 |
| IT-1122 | Catalog item 122, tours | Tours | Active | 87.89 |
| IT-1123 | Catalog item 123, transfers | Transfers | Active | 248.79 |
| IT-1124 | Catalog item 124, insurance | Insurance | Pending | 146.64 |
| IT-1125 | Catalog item 125, flights | Flights | Active | 233.92 |
| IT-1126 | Catalog item 126, hotels | Hotels | Active | 61.38 |
| IT-1127 | Catalog item 127, tours | Tours | Active | 135.63 |
| IT-1128 | Catalog item 128, transfers | Transfers | Pending | 196.93 |
| IT-1129 | Catalog item 129, insurance | Insurance | Active | 68.74 |
| IT-1130 | Catalog item 130, flights | Flights | Active | 254.28 |
| IT-1131 | Catalog item 131, hotels | Hotels | Active | 127.13 |
| IT-1132 | Catalog item 132, tours | Tours | Pending | 163.40 |
| IT-1133 | Catalog item 133, transfers | Transfers | Active | 108.84 |
| IT-1134 | Catalog item 134, insurance | Insurance | Active | 96.97 |
| IT-1135 | Catalog item 135, flights | Flights | Active | 175.74 |
| IT-1136 | Catalog item 136, hotels | Hotels | Pending | 239.43 |
| IT-1137 | Catalog item 137, tours | Tours | Active | 224.86 |
| IT-1138 | Catalog item 138, transfers | Transfers | Active | 35.04 |
| IT-1139 | Catalog item 139, insurance | Insurance | Active | 156.67 |
| IT-1140 | Catalog item 140, flights | Flights | Pending | 243.67 |
| IT-1141 | Catalog item 141, hotels | Hotels | Active | 222.68 |
| IT-1142 | Catalog item 142, tours | Tours | Active | 204.29 |
| IT-1143 | Catalog item 143, transfers | Transfers | Active | 247.64 |
| IT-1144 | Catalog item 144, insurance | Insurance | Pending | 40.21 |
| IT-1145 | Catalog item 145, flights | Flights | Active | 111.48 |
| IT-1146 | Catalog item 146, hotels | Hotels | Active | 169.98 |
| IT-1147 | Catalog item 147, tours | Tours | Active | 269.94 |
| IT-1148 | Catalog item 148, transfers | Transfers | Pending | 97.30 |
| IT-1149 | Catalog item 149, insurance | Insurance | Active | 105.30 |
| IT-1150 | Catalog item 150, flights | Flights | Active | 91.13 |
| IT-1151 | Catalog item 151, hotels | Hotels | Active | 122.08 |
| IT-1152 | Catalog item 152, tours | Tours | Pending | 182.90 |
| IT-1153 | Catalog item 153, transfers | Transfers | Active | 107.70 |
| IT-1154 | Catalog item 154, insurance | Insurance | Active | 108.97 |
| IT-1155 | Catalog item 155, flights | Flights | Active | 147.88 |
| IT-1156 | Catalog item 156, hotels | Hotels | Pending | 261.44 |
| IT-1157 | Catalog item 157, tours | Tours | Active | 34.78 |
| IT-1158 | Catalog item 158, transfers | Transfers | Active | 164.06 |
| IT-1159 | Catalog item 159, insurance | Insurance | Active | 102.57 |
| IT-1160 | Catalog item 160, flights | Flights | Pending | 153.93 |
| IT-1161 | Catalog item 161, hotels | Hotels | Active | 74.69 |
| IT-1162 | Catalog item 162, tours | Tours | Active | 136.56 |
| IT-1163 | Catalog item 163, transfers | Transfers | Active | 124.27 |
| IT-1164 | Catalog item 164, insurance | Insurance | Pending | 238.34 |
| IT-1165 | Catalog item 165, flights | Flights | Active | 182.63 |
| IT-1166 | Catalog item 166, hotels | Hotels | Active | 217.48 |
| IT-1167 | Catalog item 167, tours | Tours | Active | 150.78 |
| IT-1168 | Catalog item 168, transfers | Transfers | Pending | 99.07 |
| IT-1169 | Catalog item 169, insurance | Insurance | Active | 201.01 |
| IT-1170 | Catalog item 170, flights | Flights | Active | 121.67 |
| IT-1171 | Catalog item 171, hotels | Hotels | Active | 190.11 |
| IT-1172 | Catalog item 172, tours | Tours | Pending | 139.21 |
| IT-1173 | Catalog item 173, transfers | Transfers | Active | 145.43 |
| IT-1174 | Catalog item 174, insurance | Insurance | Active | 253.86 |
| IT-1175 | Catalog item 175, flights | Flights | Active | 86.94 |
| IT-1176 | Catalog item 176, hotels | Hotels | Pending | 216.26 |
| IT-1177 | Catalog item 177, tours | Tours | Active | 110.26 |
| IT-1178 | Catalog item 178, transfers | Transfers | Active | 228.58 |
| IT-1179 | Catalog item 179, insurance | Insurance | Active | 55.16 |
| IT-1180 | Catalog item 180, flights | Flights | Pending | 83.94 |
500 rows ยท 5 columns: Code · Description · Group · Status · Rate
#Columns from data annotations
Compare the grid with its code: there is no column markup, because headers, order, bands, formats and read-only cells come from attributes on AnnotatedGridItem.
| Identity | Amounts | |||
|---|---|---|---|---|
| Item # | SKU | Unit price | Extended | Product description |
| 1 | SKU-00001 | $19.75 | $335.75 | Travel package #1 |
| 2 | SKU-00002 | $24.00 | $576.00 | Travel package #2 |
| 3 | SKU-00003 | $28.25 | $875.75 | Travel package #3 |
| 4 | SKU-00004 | $32.50 | $1,235.00 | Travel package #4 |
| 5 | SKU-00005 | $36.75 | $1,653.75 | Travel package #5 |
| 6 | SKU-00006 | $41.00 | $2,132.00 | Travel package #6 |
| 7 | SKU-00007 | $45.25 | $2,669.75 | Travel package #7 |
| 8 | SKU-00008 | $49.50 | $3,267.00 | Travel package #8 |
| 9 | SKU-00009 | $53.75 | $3,923.75 | Travel package #9 |
| 10 | SKU-00010 | $58.00 | $4,640.00 | Travel package #10 |
| 11 | SKU-00011 | $62.25 | $5,415.75 | Travel package #11 |
| 12 | SKU-00012 | $66.50 | $6,251.00 | Travel package #12 |
Documentation
This page covers the data side of GridColumn: how a Field is resolved against each row shape, what
Type and Format change, and what the update scope does when a column is added or removed at run time.
The layout parameters (Width, HeaderBand, IsFrozen, Visible and the rest) and
the same three methods used on fixed column sets are on Column sets.