How to remove fields in WinForms GridGroupingControl?
Remove fields in GridGroupingControl
In WinForms GridGroupingControl, each time while creating columns, fields are also created along with it and in some cases the fields are unnecessary. Therefore, when there are many columns, then the fields related to it are also added and creates performance problem. To overcome the addition of fields in GridGroupingControl refer to the following solution.
Solution
To stop adding the fields to the GridGroupingControl, use the Modify() method. By using this method the fields are not added altogether. You can add the necessary fields alone, by using the TableDescriptor.Fileds.Add() method. In the following code example, there are 11 fields and only two fields “CompanyName” and “CustomerID” are added.
The following code example illustrates on how the Modify() method works.
C#
// this method stops adding fields in the Grid. this.gridGroupingControl1.TableDescriptor.Fields.Modify(); // Adding necessary Fields. this.gridGroupingControl1.TableDescriptor.Fields.Add("CompanyName"); this.gridGroupingControl1.TableDescriptor.Fields.Add("CustomerID ");
VB
'This method stops auto populating the fields in the Grid. Me.gridGroupingControl1.TableDescriptor.Fields.Modify() ' Adding necessary Fields. Me.gridGroupingControl1.TableDescriptor.Fields.Add("CompanyName") Me.gridGroupingControl1.TableDescriptor.Fields.Add("CustomerID")
The following screenshot displays only two fields, CompanyName and CustomerID.
Figure 1: Only two fields displayed in GridGroupingControl
Samples:
Conclusion
I hope you enjoyed learning about how to remove fields in WinForms GridGroupingControl.
You can refer to our WinForms Grid Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Grid Control documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Grid Control and other WinForms components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!