Hi Thomas,
Thanks for the update.
We have analyzed your scenario with provided screenshots. It seems that, the column which has value member(countryId) and display member (countryname) is grouped in your sample project. By default, in GridGroupingControl , the grouping is performed based on ValueMember , not by DisplayMemeber. So , the caption text shows value member(countryId). This the default behaviour of GridGroupingControl. In order to customize the GroupCaptionText with display text, QueryCellStyleInfo event can be used. In that event, the countryId will be replaced by countryName. Please make use of the below code,
Code example:
this.gridGroupingControl1.QueryCellStyleInfo += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity != null && e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
if (e.Style.TableCellIdentity.GroupedColumn != null && e.Style.TableCellIdentity.GroupedColumn.Name == "Land")
{
if (e.TableCellIdentity.DisplayElement.ParentGroup.GroupTypedListRecords.Count > 0)
{
Record groupRecord = e.TableCellIdentity.DisplayElement.ParentGroup.GroupTypedListRecords[0];
string cellValue = groupRecord.GetValue("Land").ToString();
string displayText = "";
DataTable table = this.gridGroupingControl1.TableDescriptor.Columns["Land"].Appearance.AnyRecordFieldCell.DataSource as DataTable;
foreach (DataRow dr in table.Rows)
{
if (dr[0].ToString() == cellValue)
{
displayText = dr[1].ToString();
break;
}
}
if (displayText != null)
e.Style.CellValue = e.Style.CellValue.ToString().Replace(cellValue.ToString(), displayText);
}
}
}
}
Sample link:
Regards,
Piruthiviraj