0
votes

I have a MVC Kendo Grid bound to a data source which works, However when I try and use the built in export to excel feature it downloads a file with incorrect dates. The grid displays as a 'Date Created' 18/08/2015 but on the excel sheet it shows 07/07/1905.

I have added my grid code below.

Html.Kendo().Grid(Of ******)()
    .Name("grid")
    .Columns(Sub(columns)
        columns.Bound(Function(c) c.ReferenceID).Width(50)                                    
        columns.Bound(Function(c) c.CommentText).Width(150)
        columns.Bound(Function(c) c.DateCreated).Width(150)
            .Format("{0:dd/MM/yyyy}")                                                                       
    End Sub)
    .HtmlAttributes(New With { 
        Key .style = "height: 500px;"                                             
    })
    .Scrollable()
    .Sortable()
    .ToolBar(Function(Toolbar) Toolbar.Excel())
    .Excel(Function(Excelexport)  
        Excelexport.FileName("*****").AllPages(True)
    )
    .Pageable(Function(pageable) pageable.Refresh(True)
    .PageSizes(True).ButtonCount(5))
    .DataSource(Function(dataSource) dataSource.Ajax()
    .PageSize(20).Events(Function(events) 
        events.[Error]("error_handler")
    )
    .Model(Sub(model)
        model.Id(Function(c) c.EncID)
    End Sub)
    .Read(Function(read) 
        read.Action("*****", "*******").Data("********")
    )
)
.Render()

Has anyone encountered this issue before or have any advice on how to get it to download properly?

Thanks

1

1 Answers