The DataFilter control supports five different kinds of filters namely, BoolFilter, RangeFilter, DateRangeFilter, ChecklistFilter and CalendarFilter, to filter different types of data. Corresponding to each filter, an accordion tab is added to the DataFilter control which contains the controls used to filter the data-aware control by a specific field. For example,
When the AutoGenerateFilters property of the C1DataFilter class is set to true, filters are automatically generated depending on the type of the fields present in the DataSource. These filters are added to the FilterCollection and can be accessed using Filters property of the C1DataFilter class.
The following code demonstrates how filters can be automatically generated in the DataFilter control.
To add filters programmatically to the DataFilter control, follow these steps:
To add a RangeFilter to the DataFilter control, use the following code. This code sets the header, editor type, editor width, tooltip, maximum value, and minimum value for the range filter.
DataFilter also supports filter reset feature. This enables you to the reset the filter selection to its default value on the click of a button. You can use reset method to implement this feature on the filters.
As shown in the GIF below, all the filter selections are cleared after clicking on the reset filter button.
To implement this feature, you can use the following code. In this code, reset method is applied on the brand filter.