This is a migrated thread and some comments may be shown as answers.

Filtering on Date Only

5 Answers 352 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rayne
Top achievements
Rank 1
Rayne asked on 09 Feb 2015, 08:32 PM
I've read the documentation that explains how to filter on the Date value only from here:
http://docs.telerik.com/devtools/wpf/controls/radgridview/filtering/how-to/howto-filter-date-value

But my grid is using auto-generated columns. How do I get this work when I'm not declaring each individual column?

5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 Feb 2015, 12:06 PM
Hi,

As your columns are auto generated, you could subscribe for RadGridView's AutoGeneratingColumn event and apply any additional setting needed.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rayne
Top achievements
Rank 1
answered on 10 Feb 2015, 01:55 PM
I'm already subscribed to that event for some other stuff.

I even have a check for the col data type so that dates are formatted to display the date only. But I'm unsure how to get the FieldName.Date into the FilterMemberPath so that it filters on Date only.
0
Dimitrina
Telerik team
answered on 12 Feb 2015, 08:51 AM
Hi,

You need to set the FilterMemberPath similarly to how you do so in xaml. Does it not work for you?

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rayne
Top achievements
Rank 1
answered on 12 Feb 2015, 07:46 PM
No. I haven't gotten it to work. I'm a bit stuck on how to identify the correct piece of data so that I can assign it to FilterMemberPath.

Here is a sample of my code, which is located in the AutoGeneratingColumn event handler:

var col = e.Column as GridViewDataColumn;
if (col.DataType == typeof(decimal?))
     col.DataFormatString = "{0:F4}";
else if (col.DataType == typeof (DateTime))
{
    col.DataFormatString = "{0:d}";
    //add code here to filter on Date portion of DateTime
}
0
Dimitrina
Telerik team
answered on 13 Feb 2015, 09:21 AM
Hi,

You can set the FilterMemberPath based on the corresponding DataMemberBinding path.
For example, having your existing code you should add a line like:
col.FilterMemberPath = col.DataMemberBinding.Path.Path + ".Date";


Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Rayne
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Rayne
Top achievements
Rank 1
Share this question
or