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

Grouping with the "Date" part of "DateTime"

1 Answer 185 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gregor Daskaloff
Top achievements
Rank 1
Gregor Daskaloff asked on 23 Nov 2010, 03:03 PM
Hi,

is it possible to group a DateTime property only with the DatTime.Date part?
I get an object with the property "Beginning" of type DateTime from Database. But I want to group only the "Day" (DateTime.Date) part, because there are diefferent times.

<GroupByExpressions>
 <telerik:GridGroupByExpression>
  <SelectFields>
   <telerik:GridGroupByField HeaderValueSeparator=" am: " FieldName="Beginning"
                             FormatString="{0:dddd, dd MMMM yyyy}" 
                             FieldAlias="Date" />
  </SelectFields>
  <GroupByFields>
   <telerik:GridGroupByField FieldName="Beginning" SortOrder="Descending" />
  </GroupByFields>
 </telerik:GridGroupByExpression>
</GroupByExpressions>

But I get an output likes this:

http://s5.directupload.net/images/101123/agcdauma.png

The 31. December is splittet into two groups, because of the different times, but I want one single group of 31. December.

Thanks in advance.

Gregor D.

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 25 Nov 2010, 06:48 PM
Hello Gregor,

You need to have a field in your data items that will return your Date values without the time portion. This way RadGrid can group by that field. Otherwise, you cannot modify the values RadGrid uses for grouping your data.

Regards,
Veli
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Gregor Daskaloff
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or