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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

121650 Jan 12,2016 08:20 PM Jan 18,2016 04:00 AM ASP.NET MVC 3
loading
Tags: Grid
Megatron
Asked On January 12, 2016 08:20 PM

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


thanks


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

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

Regards,
Ragavee U S.

Megatron
Replied On January 15, 2016 06:02 PM

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 04:00 AM

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.

http://help.syncfusion.com/aspnetmvc/grid/exporting#exporting-server-events

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

Regards,
Ragavee U S.

CONFIRMATION

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.

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.

;