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

Grouping on a datetime column

6 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
CS
Top achievements
Rank 1
CS asked on 19 May 2010, 01:36 PM
Hello,

Is there any way to group on a column of datetime values and have the groupings be done by date only, without the time portion?

Thanks,
Craig

6 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 19 May 2010, 02:05 PM
Hello CS,

If you expose a property of your business object , that contains only the date part, you may set this property to the GridViewDataColumn.GroupMemberPath.  This way when the user groups by the datetime column , RadGridView will perform the actual grouping on your new property.

Best wishes,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
CS
Top achievements
Rank 1
answered on 19 May 2010, 02:27 PM
Thank you Pavel, but exposing a new property of just the date would be quite difficult in my case.  I essentially bind the GridView to a pseudo-datatable object that we have created in Silverlight and the columns in the datatable are dynamic.  I have a number of datasources that this datatable object could be loaded from and each datasource could contain one or many datetime fields. 

Can you think of any other way to do it?  Is there a way to specify a converter for each gridviewdatacolumn that can be used to define the value that would be used from each row for grouping purposes?  That way I could convert from datetime to just date in the converter?

Thanks,
Craig
0
Pavel Pavlov
Telerik team
answered on 21 May 2010, 08:03 AM
Hi CS,

Please try to set the GroupMemberPaht to the Nested Date property of your DateTime property.
For Example if your DateTime property is named "MyProperty" the setting should be something like .

GroupMemberPath = "MyProperty.Date".


Kind regards,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
CS
Top achievements
Rank 1
answered on 21 May 2010, 02:36 PM
Thanks Pavel, but it does not work for me because the property I am binding to is of type object, not datetime.  I tried adding a Convert.ToDateTime expression into the GroupMemberPath, but that did not work either.  Is there any way that my situation could be supported in a future version of the GridView?

Craig
0
Accepted
Pavel Pavlov
Telerik team
answered on 25 May 2010, 12:24 PM
Hello CS,

I am logging the problem and it will be addressed soon .  Meanwhile the only solution would be to store the date in a DateTime property rather than Object.

Sincerely yours,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
CS
Top achievements
Rank 1
answered on 25 May 2010, 03:11 PM
Thanks, that's great.
Tags
GridView
Asked by
CS
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
CS
Top achievements
Rank 1
Share this question
or