We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GGC group header event

May I know how can I know that the group header is selected and how can I capture the data inside the header? Thank you.

5 Replies

AD Administrator Syncfusion Team May 3, 2005 08:15 AM

Do you want to know when you click on a group caption row? If so, try handling the TableControlCellClick event and testing for the caption row.
private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
	GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
	if(style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
	{
		Console.WriteLine(style.Text);
		GridCaptionRow capRow = style.TableCellIdentity.DisplayElement as GridCaptionRow;
		Console.WriteLine(capRow.ParentGroup.Category);
	}
}


AD Administrator Syncfusion Team May 4, 2005 10:03 PM

Hi there, I tried your way and it works to detect when my louse clicked on it, but I have to detect that the caption row is selected only when I click on maybe "Save" button or other buttons. which cannot be done in TableCellClick..


AD Administrator Syncfusion Team May 5, 2005 05:14 AM

Here is code that lets you check if the CurrentElement is a caption row.
private void button1_Click(object sender, System.EventArgs e)
{
	GridCaptionRow capRow = this.gridGroupingControl1.Table.CurrentElement as GridCaptionRow;
	if(capRow != null)
	{
		Console.WriteLine(capRow.ParentGroup.Category);
	}
}


AD Administrator Syncfusion Team May 10, 2005 03:04 AM

Thanks Clay... that works, how about if I need to retrieve the first row under the caption row ? I use child ?


AD Administrator Syncfusion Team May 10, 2005 03:39 AM

Once you have the group, you can get the first record from its Filteredrecord collection. GridCaptionRow capRow = style.TableCellIdentity.DisplayElement as GridCaptionRow; Console.WriteLine(capRow.ParentGroup.Category); GridRecord rec = capRow.ParentGroup.FilteredRecords[0] as GridRecord; Console.WriteLine(rec.GetValue("Col0"));

Loader.
Live Chat Icon For mobile
Up arrow icon