Back to Devexpress

How to: Filter Data by Multiple Columns

aspnet-114258-components-card-view-examples-how-to-filter-data-by-multiple-columns.md

latest981 B
Original Source

How to: Filter Data by Multiple Columns

  • Dec 17, 2020

The following code applies a filter that selects cards where the country is USA and the quantity is less than 15. The filter criteria are displayed in the ASPxCardView’s title panel.

The image below shows the result:

csharp
CardView.FilterExpression = "[Country] = 'USA' AND [Quantity] < 15";
        CardView.SettingsText.Title = CardView.FilterExpression;
        //...
        //An example on how to filter by dates
        DateTime date1 = new DateTime(1996, 12, 1);
        DateTime date2 = new DateTime(1996, 12, 31);
        string filter = String.Format("[OrderDate] > #{0}# And [OrderDate] < #{1}#",
        date1.ToShortDateString(), date2.ToShortDateString());
        CardView.FilterExpression = filter;