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.

How to get all the GridRecords that belong to a GridCaptionSection groups

Thread ID:

Created:

Updated:

Platform:

Replies:

55102 Jan 23,2007 05:19 PM Jan 23,2007 07:32 PM Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On January 23, 2007 05:19 PM

I have a single flat datasource that is bound to a ggc.
The ggc is is grouped via..

this.ggc.TableDescriptor.GroupedColumns.Add("SellingTitleName");

.. hence, my ggc looks like this..


GroupCaptionSection
------GridRecord
------GridRecord
------GridRecord
GroupCationSection
-----GridRecord
GroupCaptionSection
-----GridRecord
-----GridRecord

Normally, the GridCaptionCell will display the group name with the number of items, for example ' : 12 items, for example.

My issue is, when the GroupCaptionCell is the currentactivecell, how do i get all the GridRecords that belong to this grouping.

The user wants to right-click on a group and perform an action, for example, delete all the records that below to this grouping.

Administrator [Syncfusion]
Replied On January 23, 2007 06:50 PM

Hi James,

Here is a code snippet that shows you how to get all the GridRecords that belong to a GridCaptionSection in a TableControlCurrentCellActivated event.

private void gridGroupingControl1_TableControlCurrentCellActivated(object sender, GridTableControlEventArgs e)
{
GridCurrentCell cc= e.TableControl.CurrentCell;
Element el = e.TableControl.Table.DisplayElements[cc.RowIndex];
if( el.Kind == DisplayElementKind.Caption )
{
if( el.ParentGroup != null
&& el.ParentGroup.ParentChildTable != null)
{
foreach(Record rec in el.ParentGroup.Records)
Console.WriteLine(rec);
}
}
}

Please refer to the attached sample for implementation.
GGC_Group.zip

Best Regards,
Haneef

James Blibo
Replied On January 23, 2007 07:16 PM

Thanks...

One more question... What if the current cell is a GridRecord? How would you access the GridRecord from this same event 'TableControlCurrentCellActivated'?

James Blibo
Replied On January 23, 2007 07:32 PM

never mind... found it..

if (el.Kind == DisplayElementKind.Record && el.ParentTable != null)
{
Record r = el.ParentTable.CurrentRecord;
}

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.

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.

;