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.


Thread ID:





22323 Dec 9,2004 03:30 PM Dec 13,2004 04:57 PM Windows Forms 6
Tags: Grouping
Bernard Herrok
Asked On December 9, 2004 03:30 PM

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.

Administrator [Syncfusion]
Replied On December 10, 2004 12:56 PM

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

Bernard Herrok
Replied On December 12, 2004 03:56 PM

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.

Administrator [Syncfusion]
Replied On December 13, 2004 03:28 AM

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.

Administrator [Syncfusion]
Replied On December 13, 2004 03:33 AM

Here is the sample in VB.

Bernard Herrok
Replied On December 13, 2004 03:20 PM

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?

Administrator [Syncfusion]
Replied On December 13, 2004 04:57 PM

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


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.