)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to group the unbound column in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: May 10, 2016 |
Last Revised Date: February 12, 2020

Group the unbound column

Since the unbound column data are not bound to the data source, the grouping of these columns are not possible. In order to group the unbound column, the unbound column needs to be populated with the data and it can be populated by handling the QueryValue event.

C#

////Set Hashtable vaule
for (int i = 0; i < this.gridGroupingControl1.Table.FilteredRecords.Count; i++)
{
    UnboundValues.Add(this.gridGroupingControl1.Table.FilteredRecords[i].Id, i + 20);
}
this.gridGroupingControl1.TableDescriptor.QueryValue += new FieldValueEventHandler(TableDescriptor_QueryValue);
 
void TableDescriptor_QueryValue(object sender, FieldValueEventArgs e)
{
   int recordIndex = this.gridGroupingControl1.Table.PrimaryKeySortedRecords.IndexOf(e.Record);
   if (e.Field.Name == "UnBoundColumn" && e.Record.Id >= 0)
   {
      e.Value = UnboundValues[e.Record.Id];
   }
}

VB

'//Set Hashtable vaule
For i As Integer = 0 To Me.gridGroupingControl1.Table.FilteredRecords.Count - 1
     UnboundValues.Add(Me.gridGroupingControl1.Table.FilteredRecords(i).Id, i + 20)
Next i
AddHandler gridGroupingControl1.TableDescriptor.QueryValue, AddressOf TableDescriptor_QueryValue
 
void TableDescriptor_QueryValue(Object sender, FieldValueEventArgs e)
     Dim recordIndex As Integer =  Me.gridGroupingControl1.Table.PrimaryKeySortedRecords.IndexOf(e.Record)
     If e.Field.Name = " UnBoundColumn " AndAlso e.Record.Id >= 0 Then
        e.Value = UnboundValues(e.Record.Id)
     End If 
End Sub

 

Show group the unbound column

Samples:

C#: Grouping by UnboundColumn_CS

VB: Grouping by UnboundColumn_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon