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

Formatting DateTime in the Column Total Header

1 Answer 17 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Brent Hetland
Top achievements
Rank 1
Brent Hetland asked on 27 Aug 2015, 02:34 PM

Hi,

I am using 2015.1.401.40 of your ASP.NET controls for AJAX.

One of my PivotGridColumnField's is a smalldatetime field from SQL Server.

In the PivotGrid column header labels I want the dates to be formatted as MMM-yy,  like Aug-15.

I can accomplish that for the detail columns (the non-aggregate columns) by setting the DataFormatString="{0:MMM-yy}"

But that doesn't affect the label of the column total header.  That header label reads:  "08/01/2015 00:00:00 Total"

Again, my goal is to have it read:  Aug-15 Total

How can I accomplish this?  I can't believe there isn't a property to control it...

I've seen a couple of suggestions where people were told they should change the header text in the CellDataBound Event, but the problem is that in this event I don't seem to have access to the date value.  I have only seen that I can read the current header text which again is a string of a date and the word "Total".

I don't want to strip the word "Total" out of that string and then then convert the date that remains to a string in the date format I want.  We do localization here so I would imagine that if my culture was something other than English, the word "Total" would be translated into another language.

If there isn't a neat and clean way to do this, it seems like a big oversight (missing functionality) on the part of the pivotgrid.

Thanks,

Brent

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 01 Sep 2015, 10:12 AM
Hello Brent,

I am sorry but with the current implementation one should parse the string and modify it according to the requirements. If exposing a custom format options is mandatory for your project you can log a feature request in our feedback portal. That way our developers will examine the matter and if possible improve the control functionality for a future release.

Regards,
Angel Petrov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
PivotGrid
Asked by
Brent Hetland
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or