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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC group header event

Thread ID:

Created:

Updated:

Platform:

Replies:

28477 May 3,2005 04:26 AM UTC May 10,2005 08:39 AM UTC Windows Forms 5
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On May 3, 2005 04:26 AM UTC

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.

Administrator [Syncfusion]
Replied On May 3, 2005 01:15 PM UTC

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);
	}
}

Administrator [Syncfusion]
Replied On May 5, 2005 03:03 AM UTC

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..

Administrator [Syncfusion]
Replied On May 5, 2005 10:14 AM UTC

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);
	}
}

Administrator [Syncfusion]
Replied On May 10, 2005 08:04 AM UTC

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

Administrator [Syncfusion]
Replied On May 10, 2005 08:39 AM UTC

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"));

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;