Hi Patrick,
Please refer to the attached sample for implementation and let me know if this helps.
CaptionTextSample.zipBelow are the codes that display first record values in a GridCaptionRow.
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.GroupedColumn != null)
{
Element el = e.TableCellIdentity.DisplayElement;
if (el.ParentGroup.GroupTypedListRecords.Count > 0)
{
switch (e.TableCellIdentity.TableCellType)
{
case GridTableCellType.GroupCaptionCell:
Record rec = el.ParentGroup.GroupTypedListRecords[0];
e.Style.CellValue = rec.GetValue(e.TableCellIdentity.GroupedColumn.Name);
break;
case GridTableCellType.GroupCaptionSummaryCell:
Record rec1 = el.ParentGroup.GroupTypedListRecords[0];
if (e.TableCellIdentity.SummaryColumn != null)
e.Style.CellValue = rec1.GetValue(e.TableCellIdentity.SummaryColumn.Name);
else
{
GridTableDescriptor _td = el.ParentTableDescriptor as GridTableDescriptor;
int field = _td.ColIndexToField( e.TableCellIdentity.ColIndex );
if (field != -1 && field < _td.Columns.Count)
{
string _colName = _td.Columns[field].Name;
e.Style.CellValue = rec1.GetValue(_colName);
}
else
e.Style.CellValue = string.Empty;
}
break;
}
}
}
}
Best regards,
Haneef