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.

Grid to not Expand Child with no data

Thread ID:





42938 Apr 10,2006 06:19 PM Jul 11,2011 02:21 AM Windows Forms 8
Tags: GridControl
Chris Wescott
Asked On April 10, 2006 06:19 PM

Hi, I am having an issue with your grid grouping control. I have a parent Child table relation type grid and some parents have no children. However when I use the command GridGroupingControl1.Table.ExpandAllRecords() It expands the parents with no children and shows the column headers of the child table. Is there a way to either cancel the row.expanding method or to set the grid to not expand parents with no children. I have removed the plus signs by making the cell = "Static" but GridGroupingControl1.Table.ExpandAllRecords seems to ignore that the parents have no plus sign. Regards, Chris Wescott

Administrator [Syncfusion]
Replied On April 11, 2006 03:10 AM

Hi Chris, The parent records that have no child record can be prevented from expanding by handling the Table.RecordExpanding event and by setting the e.Cancel to true when there is no child records for a parent record. Below is a code snippet. private void Table_RecordExpanding(object sender, RecordEventArgs e) { if(e.Record.GetRelatedChildTable(new RelationDescriptor("ParentToChild")).GetRecordCount() == 0) e.Cancel = true; } Regards, Calvin.

Chris Wescott
Replied On April 11, 2006 04:06 PM

Hi, This doesn''t seem to work perhaps I am firing it on the wrong event but there is no table.recordexpanding event for the GGC Here is a code snippet Private Sub GridGroupingControl1_RecordExpanding(ByVal sender As System.Object, ByVal e As Syncfusion.Grouping.RecordEventArgs) Handles GridGroupingControl1.RecordExpanding If e.Record.HasNestedTables = False Then e.Cancel = True End If End Sub Vb Examples are best for me as that is what I am writing in, any ideas? Thanks, Chris Wescott

Administrator [Syncfusion]
Replied On April 12, 2006 01:36 AM

Hi Chris, Attached is a sample in both CS and VB. Regards, Calvin.


Chris Wescott
Replied On April 12, 2006 09:39 AM

Thanks Calvin, It works Great!!!

Replied On February 24, 2011 05:33 PM

I am not able to download the code.

Jisha Joy [Syncfusion]
Replied On February 25, 2011 12:04 AM

Hi Avinash,

I could able to download it. Please use the following link to the sample.



Replied On July 9, 2011 05:21 PM


Anyone can tell me how to get rid of the plus/minus sign if the parent record does not have any childrens?

And is it possible to move the plus/minus sign to some other cell instead of the first cell if the parents do have childrens?

Thanks much

Jisha Joy [Syncfusion]
Replied On July 11, 2011 02:21 AM


The ChildTable can be made hidden when it has no records to show up, by having a CustomEngine. Derive the GridChildTable in the CustomGroupingEngine and override the GetVisibleCount(), there check whether Records.Count equals 0 for the childtable and return 0. This will make the ChildTable to be hidden when it has no records to show.
In addtion, if the +/- buttons also has to be hidden then, the QueryCellStyleInfo event of the GridGroupiingControl can be handled to do this.
Please refer to the sample,




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.