How to apply dynamic filter for the GridGrouping control with data containing foreign key?
To apply dynamic filter to the Grid Grouping control that has foreign key relation, you need to use the GridDynamicFilter object to wire the Grid. You also have to enable the AllowFilter option.
C#
GridDynamicFilter filter = new GridDynamicFilter(); //Enables the dynamic filter. filter.WireGrid(gridGroupingControl1); this.gridGroupingControl1.TopLevelGroupOptions.ShowFilterBar = true; //Sets the foreign key relation. GridForeignKeyHelper.SetupForeignTableLookUp(gridGroupingControl1, "Country", countries, "CountryCode", "CountryName"); for (int i = 0; i < gridGroupingControl1.TableDescriptor.Columns.Count; i++) gridGroupingControl1.TableDescriptor.Columns[i].AllowFilter = true;
VB
Dim filter As New GridDynamicFilter() Me.gridGroupingControl1.TopLevelGroupOptions.ShowFilterBar = True 'Enables the dynamic filter. filter.WireGrid(gridGroupingControl1) 'Sets the foreign key relation. GridForeignKeyHelper.SetupForeignTableLookUp(gridGroupingControl1, "Country", countries, "CountryCode", "CountryName") For i As Integer = 0 To gridGroupingControl1.TableDescriptor.Columns.Count – 1 gridGroupingControl1.TableDescriptor.Columns(i).AllowFilter = True Next i
The following image illustrates the Grid with foreign relation key having dynamic filters:
Sample Links:
C#: DynamicFiltering
VB: DynamicFiltering
Conclusion
I hope you enjoyed learning about how to apply dynamic filter for the GridGrouping control with data containing foreign key.
You can refer to our
WinForms GridGroupingControl
feature tour page to know about its other groundbreaking
feature representations. You can also explore our
WinForms
GridGroupingControl documentation to understand how to create and
manipulate data.
For current customers, you can check out our 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!