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


Hi, I have a grouping grid that has 5 to 6 levels and it''s databound. I have a column called DoExpand with the values 1 or 0. I''d like the grid on load to expand only the groupings with DoExpand = 1. Also, if the child''s DoExpand = 1 but the parent not, will the grid expand the parent so it can expand the child? thanks.

6 Replies

AD Administrator Syncfusion Team December 10, 2004 05:56 PM UTC

Hi Bernard, I am not not sure I fully understand the questions, but here is a try: You can loop through all the records in the grid and call ShowRecord(). This will make sure the record will be visible and all parent groups are expanded: foreach(Record r in this.gridGroupingControl1.Table.Records) { string s = r.GetValue("DoExpand").ToString(); if(s == "1")) this.gridGroupingControl1.Table.ShowRecord(r); } If this is not what you need can you post a sample project that shows what you need? I could then modify it to get it working. Thanks, Stefan

BH Bernard Herrok December 12, 2004 08:56 PM UTC

hi, i tried your code, and nothing happens. i needed to put true/false as the last item in the signature. .Table.ShowRecord(r, True) The grid records are still colapsed.

AD Administrator Syncfusion Team December 13, 2004 08:28 AM UTC

Here is a sample that expands all nodes where [Name] Like ''1''. You have to recursively check records, and then expand things (records and childtables) as you back out of the recursion if you have found what you are looking for.

AD Administrator Syncfusion Team December 13, 2004 08:33 AM UTC

Here is the sample in VB.

BH Bernard Herrok December 13, 2004 08:20 PM UTC

Hi, I had a look at your sample, but i don''t have any nested tables. It''s just the 1 table with multiple groupings. I changed the code to this, but it still wont expand. Dim isExpanded As Boolean = False Dim r As Record For Each r In MarketingDG.Table.Records Dim o As Object = r.GetValue("DoExpand") If Not o Is Nothing AndAlso o.ToString = "1" Then r.SetExpanded(True, True, False) r.InvalidateSummariesBottomUp() End If Next MarketingDG.Table.InvalidateSummariesBottomUp() MarketingDG.TableControl.Refresh() ---- = ---- Are there any properties that does not allow the grid to programatically expand?

AD Administrator Syncfusion Team December 13, 2004 09:57 PM UTC

Here is code that opens groups where Col3="1".
Private Sub button2_Click(sender As Object, e As System.EventArgs)
   Dim r As Record
   For Each r In  Me.gridGroupingControl2.Table.Records
      If r.GetValue("Col3").ToString() = "1" Then
         Dim el As Element = r
         While Not (el.ParentGroup Is Nothing)
            el.ParentGroup.IsExpanded = True
            el = el.ParentGroup
         End While
      End If
   Next r
End Sub ''button2_Click

Live Chat Icon For mobile
Up arrow icon