Version

We recommend that you use the xamDataGrid control instead of the xamGrid control. The xamGrid is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamGrid during this time. 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();