We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid export to PDF or Excel, after grouping, filtering gives an error

Thread ID:





121650 Jan 13,2016 01:20 AM UTC Jan 18,2016 09:00 AM UTC ASP.NET MVC 3
Tags: Grid
Asked On January 13, 2016 01:20 AM UTC

Hi, how to export the filtered or grouped grid.

When I do this it give me an error, is this a big, I am using your sample code from the demos

Server Error in '/' Application.

String was not recognized as a valid DateTime.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error: 

Line 120:            GridProperties obj = ConvertGridObject(GridModel);
Line 121:
Line 122:            exp.Export(obj, DataSource, "Export.pdf", false, false, "flat-saffron");
Line 123:
Line 124:        }

Source File: C:\\Controllers\GridExportrController.cs    Line: 122 

Stack Trace: 

[FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +11626318
   System.Convert.ToDateTime(String value) +83
   Syncfusion.EJ.Export.GridPdfExport.RenderGroupedRows(GroupResult context, Int32 groupLevel) +658
   Syncfusion.EJ.Export.GridPdfExport.<RenderGroupedData>b__8(GroupResult i) +46
   Syncfusion.Linq.FunctionalExtensions.ForEach(IEnumerable`1 items, Action`1 action) +146
   Syncfusion.EJ.Export.GridPdfExport.RenderGroupedData() +88
   Syncfusion.EJ.Export.GridPdfExport.ProcessGridContents() +94


Ragavee U S [Syncfusion]
Replied On January 13, 2016 09:10 AM UTC

Hi Megatron,

Thanks for your interest in Syncfusion products.

We are able to reproduce the reported issue in the below scenario.

Scenario: When grouping a column with type “date” and exporting the grid. The Column type is defined as “string” in class definition and “date” in column definition. If the column has incorrect date format eg. 13-14/15, upon exporting, the reported exception occurs.

So please ensure if the scenario in your project corresponds to the same scenario as mentioned above. If so, we suggest you to provide proper dateTime format to the corresponding column.

For your convenience, we have created a sample to export grouped grid, which can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/121650/ze/Sample_Exporting1237505845

Ragavee U S.

Replied On January 15, 2016 11:02 PM UTC

Thanks, that fixed it.  Can you please update the control, so the exported dataset is better formatted/aligned with a header option to insert the name of the grid with the operations performed (let these be overrides to add a header name).

It would be so much easier with some information, in its current state the alignment and the data exported is hard to read by the user.

Ragavee U S [Syncfusion]
Replied On January 18, 2016 09:00 AM UTC

Hi Megatron,

Thanks for your update.

We have inbuilt exporting server side events support to customize a particular row/cell. Please refer to the following online documentation for more information on the Exporting Server side event handlers.


Similarly, we can also append comments to the exported file. Please refer to the below documentation for more information.

Documentation Link: http://www.syncfusion.com/downloads/support/forum/121650/ze/Adding_comments_while_exporting-423099094

For your convenience, we have created a sample to add custom headers to the exported pdf document, which can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/121650/ze/Sample_Exporting_with_headers-530975413

Ragavee U S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon