Version

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. For help or questions on migrating your codebase to the XamDataGrid, please contact support.

Programmatically Create a Filter

In certain situations you may want to display filtered information in the xamGrid™ control to your end user. For example an end user may only be interested in seeing the products whose ID is greater than 15.

The following code demonstrates how to create a filter programmatically.

In Visual Basic:

Imports Infragistics.Controls.Grids
Imports Infragistics
..
'Enable Filtering
MyDataGrid.FilteringSettings.AllowFiltering = FilterUIType.FilterRowTop
MyDataGrid.FilteringSettings.FilteringScope = FilteringScope.ColumnLayout
'Add a filter to the ProductID columns, specifying values must be greater than 15
MyDataGrid.Columns.DataColumns("ProductID").FilterColumnSettings.FilterCellValue = 15
MyDataGrid.Columns.DataColumns("ProductID").FilterColumnSettings.FilteringOperand = New GreaterThanOperand

In C#:

using Infragistics.Controls.Grids;
using Infragistics;
…
//Enable filtering
MyDataGrid.FilteringSettings.AllowFiltering = FilterUIType.FilterRowTop;
MyDataGrid.FilteringSettings.FilteringScope = FilteringScope.ColumnLayout;
//Add a filter to the ProductID columns, specifying values must be greater than 15
MyDataGrid.Columns.DataColumns["ProductID"].FilterColumnSettings.FilterCellValue = 15;
MyDataGrid.Columns.DataColumns["ProductID"].FilterColumnSettings.FilteringOperand=new GreaterThanOperand();