Skip to main content

Filter Card View Data in Code

To apply a filter to ASPxCardView, specify the filter expression and assign it to the ASPxGridBase.FilterExpression.

The ASPxGridBase.FilterExpression property allows you to provide complex filter criteria (filter data by multiple columns).

Example 1

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:


        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;

Note that if you set the ASPxGridBase.FilterExpression property to an empty string, the filter expression applied to ASPxGridView is cleared.

CardView.FilterExpression = String.Empty;
See Also