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.
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
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);
}
}
AD
Administrator
Syncfusion Team
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..
AD
Administrator
Syncfusion Team
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);
}
}
AD
Administrator
Syncfusion Team
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 ?
AD
Administrator
Syncfusion Team
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"));
SIGN IN To post a reply.
- 5 Replies
- 1 Participant
-
AD Administrator
- May 3, 2005 04:26 AM UTC
- May 10, 2005 08:39 AM UTC