Problem with filtering Date using Gridfilterbar

Hi,

I am using GridFilterBar to filter the rows in the grid. It is working fine to filter formatted strings and formatted decimals but i am getting problem while filtering dates using FilterBar.
The attached sample will help you to understand the above mentioned problem.

I tried by giving different formats to the dates in filter bar. In Form1_Load i commented some code which is used to format the date fields of filter bar.

In both the cases i am unable to filter the dates in the grid. So please comeup with a solution as it is an urgent need for me.

Thanks
-Pradeep


FilterBarRounding_21720.zip

3 Replies

RA Rajagopal Syncfusion Team June 7, 2007 09:19 PM UTC

Hi Pradeep,

The GridDataBoundGrid uses the DataView.RowFilter property to handle filtering that requires #'s around dates.

Here is a forum thread that discusses this.
http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=29956

Regards,
Rajagopal


PK Pradeep Kumar June 8, 2007 01:57 PM UTC

Hi Rajagopal,

Thanks for your response. I am able to filter dates with the code snippet sent by you. But i am not able to filter the time values. If i format the dates to display only time values then it is not filtering those values.

The attached sample will help you to understand the problem i got. Please comeup with a solution to this problem.

Thanks
-Pradeep



GDBG_FilterBar_Dates.zip


RA Rajagopal Syncfusion Team June 8, 2007 09:45 PM UTC

Hi Pradeep,

The problem is that the DataView.RowFilter is getting failed in this aspect. You could see the same issue when applying the DataView.RowFilter to the DataGrid.

To get this working properly, set the milliseconds value to zero in the DateTime constructor. Please refer to the modified sample below that works fine.

DateTime tt = DateTime.Today;
DateTime date = new DateTime(tt.Year, tt.Month, tt.Day, tt.Hour, tt.Minute, tt.Second, 0);

Here is the sample download link
http://websamples.syncfusion.com/samples/Grid.Windows/F62079/main.htm

Regards,
Rajagopal

Loader.
Up arrow icon