Last Updated: 23 Dec 2019 09:27 by ADMIN
Created on: 28 Aug 2019 12:41
Category: Grid
Type: Bug Report
RadGrid Export to Excel Date format not taken into account

I have a Telerik RadGrid, and there is a date column on the grid layout. The date format I am using to display date values is "dd/MM/yyyy". Then, I export that grid data to Excel file with GridExcelExportFormat.Biff type. The problem here is when I open the newly exported Excel file, the date format is changed to "MM/dd/yyyy". 

I want to keep displaying my date format "dd/MM/yyyy" in the Excel file after exporting the grid data.

Posted on: 29 Aug 2019 04:55


The solution is acceptable to me.

Attila Antal
Posted on: 28 Aug 2019 12:59

Thank you for taking the time reporting this issue.

There is indeed some some parsing issue in the control which confuses the Cultures and it produces a different format in the exported content. 


We have found a way to work around the issue. That is by changing the DataType property of the column to string. The logic that exports the data will not have any further changes on the format.

Wire up the ItemCommand event to the Grid, check for the ExportCommand, loop through the GridDateTimeColumns and change their DataType property. This will have no impact on the Grid rendered on the Web page.


Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
    'when exporting to excel
    If e.CommandName = RadGrid.ExportToExcelCommandName Then
        'loop through the GrDateTimeColumns
        For Each dateColumn As GridDateTimeColumn In RadGrid1.MasterTableView.RenderColumns.OfType(Of GridDateTimeColumn)
            'change their DataType to String to avoid further adjustment of the current format
            dateColumn.DataType = Type.GetType("System.String")
    End If
End Sub


Please excuse us for any inconvenience this may have caused.