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. Image for the cookie policy date

Exporting to Excel causes an exception while deserializing GridProperties

I have code that is dealing with exporting a Grid control to Excel. Within the grid is a checkbox that's used for selecting specific rows. If I check a few rows and try to export I get an InvalidOperationException thrown when trying to deserialize the grid model JSON to a GridProperties object. The field that causes the exception is named CurrentIndex and it's type is int but the JSON has an array of ints in that field. To me this feels like an issue with the GridProperties class not matching the JavaScript model. What can be done to fix this issue?

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team August 8, 2017 12:31 PM UTC

Hi Andrew, 

Thanks for contacting Syncfusion support. 

We created a sample and in this sample we set column type as checkbox used for selecting specific rows. Once we check a few rows and export to excel we did not face any exception in our sample.  

Find the code example and sample:  


@(Html.EJ().Grid<object>("FlatGrid") 
        .Datasource((IEnumerable<object>)ViewBag.datasource) 
        .AllowPaging() 
        .IsResponsive() 
        .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items => 
         { 
            items.AddTool(ToolBarItems.ExcelExport); 
            items.AddTool(ToolBarItems.WordExport); 
            items.AddTool(ToolBarItems.PdfExport); 
         })) 
        .Columns(col => 
        { 
            col.Type("checkbox").Width(50).Add(); 
            col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add(); 
            ----------------------- 
       }) 
  ) 


To find out the root cause, we need the following details. 

1. Share the code example of Grid and controller. 

2. Have you mentioned field property for the checkbox column? 

3. Share the screenshot and stackrace of an exception. 

4. Essential Studio Version details.  

5. If possible, replicate the issue in the attached sample.  

Regards, 
Prasanna Kumar N.S.V 
 


Loader.
Live Chat Icon For mobile
Up arrow icon