0
votes

I'm trying to apply filter parameters from a little form to a DevExpress grid. I did this by binding the FilterString from the grid to a string in the ViewModel.

​currently I construct the filterstring as follows: ​

filterString += "[" + column.Header + "] >= '" 
                + ((DateTime)searchParameter).ToString("dd-MM-yyyy") 
                + "' AND [" + column.Header + "] < '" 
                + ((DateTime)searchParameter).AddDays(1).ToString("dd-MM-yyyy") 
                + "'";

in which the column header and field name come from the columnMap and the searchParameter is the date to filter on.

The filter is applied correctly and also shown in the bottom of the grid. You can also edit it, but only string values are shown in the filter row at the top of the grid. Dates or Numbers aren't shown there.

How can I also get dates and numbers to show in the filter row if I set a filterstring?

It currently looks like this when filtering on name (data edited out): enter image description here

1
try using system default Date format by calling ((DateTime)searchParameter).ToShortDateString() instead of ((DateTime)searchParameter).ToString("dd-MM-yyyy") . Maybe DX cannot understand your date correctly. - andrews
I tried some different formattings including that,but it didn't work. - Sebastiaan Hoedeman

1 Answers

0
votes

This should help you:

GridColumn.FilterMode Property

DX suggests to set GridColumn.FilterMode property of the date column to DisplayText.