Skip to main content

How to: Filter Data by Multiple Columns

The following code applies a filter that selects departments whose budget is greater than 100,000 and that are located in Monterey. The filter criteria are displayed within the ASPxGridView’s Title Panel.

The image below shows the result:

ASPxGridView_FilterExpression

ASPxGridView1.FilterExpression = "[Budget] > 100000  AND [Location] = 'Monterey'";
ASPxGridView1.SettingsText.Title = ASPxGridView1.FilterExpression;
// ...
// An example on how to filter by dates
DateTime date1 = new DateTime(1995, 1, 1);
DateTime date2 = new DateTime(1995, 7, 1);
string filter = String.Format("[OrderDate] > #{0}# And [OrderDate] < #{1}#",
                    date1.ToShortDateString(), date2.ToShortDateString());
ASPxGridView1.FilterExpression = filter;