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

Grouping for datetime with specified Dateformatstring not working

4 Answers 166 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 22 Nov 2010, 05:39 PM
Hi guys

I'm having a radgrid and a DateTime column

Nevertheless, i only want to display the date (without time)
<tcg:GridViewDataColumn DataMemberBinding="{Binding ITEM.Deliverydate}" DataFormatString="{}{0:dd/MM/yyyy}" Header="Delivery Date"  >
This also works fine so far, but when i comes to grouping this column it's not working.

Somehow it looks for me that the grouping in the background also uses the time, thats why i get different groups per item with always the same date.
This looks a little bit weired because the grouping text is always the same. If i have three entries with Deliverydate 20.11.2010 then the group looks like
20.11.2010    aggregate function: 1 item
20.11.2010    aggregate function: 1 item
20.11.2010    aggregate function: 1 item

correct would be
20.11.2010     aggregate function: 3 item

any suggestions?
thanks

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 22 Nov 2010, 05:47 PM
Hi Thomas Roithmeier,

You have correct assumptions about the reason for this.

To overcome this you can set the GroupMemberPath property of the column to "ITEM.Deliverydate.Date"

Let me know if this helps.

Sincerely yours,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Andreas
Top achievements
Rank 1
answered on 23 Nov 2010, 05:18 AM
Hi,

When i try the groupmemberpath i get the following exception

Invalid property or field - 'Date' for type: DateTime?

I already tried to use a converter so that nu nullable string is available on the databinding --> but this is not working for the groupmemberpath. Is there a way to do a converter for groupmemerpath?

DataMemberBinding

 

 

="{Binding Deliverydate,Converter={StaticResource NullToEmptyConverter}}"

 

0
Veselin Vasilev
Telerik team
answered on 25 Nov 2010, 03:10 PM
Hi Thomas Roithmeier,

I have already replied to your support ticket:

I could not reproduce the problem with the latest assemblies - Q3 2010. Please find attached a sample project. You will see that the Liverpool and Liverpool 2 records has the same date, but different time. Now, if you group by Est. column you will see that those records fall in one group because of the GroupMemberPath property.

The project is here.

Sincerely yours,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Mohammad
Top achievements
Rank 1
answered on 26 Nov 2011, 07:43 PM
Thanks. Very good
Tags
GridView
Asked by
Andreas
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Andreas
Top achievements
Rank 1
Mohammad
Top achievements
Rank 1
Share this question
or