$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
GridView Control for Windows Forms
Set data grouping in grid by using DataGridView component in Windows Forms applications
Home > WinForms UI Controls > User Manual > Format Header Row of Grid Grouping in C#

Formatting Group Header Row to GridView

The Kettic GridView contains a GroupSummaryEvaluate event which allows the users to change the header text of the group grid rows as necessary. To change the header text of the group, we need subscribe to the GroupSummaryEvaluate event to fire it and then perform the grid data grouping. This event is fired when displaying the GroupContentCellElement which control the group header row. Otherwise, the default value will be applied.

How to Create Formatting Group Header Row in C#

The following is the example that shows how to create custom text for the group header row of each group when grouping according to specific column.

Change Group Header Text in C#

C# code for modifying the group header text to GridView

void ketticGridView1_GroupSummaryEvaluate(object sender, Kettic.WinForms.UI.GroupSummaryEvaluationEventArgs e)
{
if (e.SummaryItem.Name == "Product")
{
e.FormatString = String.Format("Group by product: {0}", e.Value);
}
}

Format Group Header Row in C#

The following is the example that shows how to create formatting group header according to the data from the group rows in GridView.
C# code for formatting group header based on the data from the group rows

void ketticGridView1_GroupSummaryEvaluate1(object sender, Kettic.WinForms.UI.GroupSummaryEvaluationEventArgs e)
{
if (e.SummaryItem.Name == "ProductName")
{
int count = e.Group.ItemCount;
int contactsInJapan = 0;
foreach (GridViewRowInformation row in e.Group)
{
if (row.Cells["Product"].Value.ToString() == "Japan")
{
contactsInJapan++;
}
}
e.FormatString = String.Format("There are {0} {1} and {2} of them is(are) from Japan.", count, e.Value, contactsInJapan);
}
}

UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls