Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to create custom editors in a filter row

$
0
0

This example demonstrates how to filter a range of dates using a custom FilterCell Template. It also demonstrates the use of custom editors in column filter cells, including Apply/Clear buttons in a command column.

Custom filter buttons are implemented by ASPxHyperlink controls. Their visibility is set in the Init event handler, using the flag ("filtered" variable). When these buttons are clicked, they set/clear the filter of the Grid and also switch the flag.

We need to use a custom template for all the columns, so we create the ASPxTextBoxes, applying ClientInstanceName, formed with the help of the current column index. We need to do so, to access them later in the code.


Our ApplyFilter method is building a filter expression. To learn more about the syntax of the criteria language see here. In the ApplyFilter method we iterate through Grid columns. If we use a common control (ASPxTextBox) we just add criteria if it contains some text, but if we use our custom column, we utilize a special method to form the date range criteria and add it to the filter criteria expression. After that we apply this filter expression to our Grid using ApplyFilter method. To clear filter we use ClearFilter in the Click event of our clear button.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>