davidegironi / advanceddatagridview

A .NET WinForms DataGridView with advanced capabilities
392 stars 123 forks source link

DateTime Filtering #84

Closed Xounay1 closed 2 years ago

Xounay1 commented 2 years ago

Hello,

When I'm trying to filter date or datetime columns, the filter form is displaying nodes like string.

Can you help me please ?

davidegironi commented 2 years ago

Hello, you need to have a BindingSource with a DataSource with DateTime type column in order to use the Date kind filter. Take a look to the sample project as reference.

Xounay1 commented 2 years ago

My Datasource is using datetime , my field in the DB is a datetime. image

My issue 👍 image

I'm using en-US culture

davidegironi commented 2 years ago

You have to check the DataSource of the BindingSource attached to the DataGridView. Take a look at the sample project. Another sample you can look at is this porject here https://github.com/davidegironi/dentned

Xounay1 commented 2 years ago

what should I check at the DataSource level ? image

In my datatable the column is set as System.DateTime, in the database the type is DateTime as well.

davidegironi commented 2 years ago

You should iterate each DataTables, and check for the DataColumn type.

Xounay1 commented 2 years ago

I only have 1 datatable, image

I tryied to create a new simple project just doing a TOP (100) on a DateTime field from a simple Table, I'm experiencing the same issue.

Could it related to my OS culture info ? or to my datetime data format setup ? HKEY_CURRENT_USER\ Control Panel\International\sShortDate HKEY_CURRENT_USER\ Control Panel\International\sShortTime HKEY_CURRENT_USER\ Control Panel\International\sTimeFormat

Xounay1 commented 2 years ago

I also tried to create a simple project loading dynamically data from a SQL query(forcing to CAST AS DATE) to a datatable then filling the ADGV with the datatable, same result. image

Xounay1 commented 2 years ago

UP