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

ASPxGridView – How to filter by null and empty cell values using Filter Bar when FilterMode is DisplayText

$
0
0

When a header filter is used for a column and its FilterMode is set to “DisplayText”, the predefined “(Blanks)” criterion returns rows with values equal to null or empty, whereas in a grid’s Filter Bar the “Is blank” condition will not return anything. 

This can be described by the fact that in the former case, the resultant CriteriaOperator will be built as “IsNullOrEmpty”, while in the latter case it will be “IsNull”. In order to make Filter Bar work in the same way, it’s possible to parse its filter expression and replace IsNull operator with the required IsNullOrEmpty

This example uses a parsing technique demonstrated in E3396: How to delete all criteria corresponding to a particular field from CriteriaOperator. In this case, the CriteriaHelper class was slightly modified so that the UnaryOperator of type IsNull is replaced by the FunctionOperator of type IsNullOrEmpty.

The modified filter expression is applied on a grid’s callback.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



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