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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Null Exception while exporting


When the columns bound to the Grid are not defined in the Grid dataSource, and are passed to the exporting method in Code behind, a null exception is thrown as follows.


System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
       at Syncfusion.EJ.Export.GridExcelExport.ProcessRecordCell(Object row, Column column)
       at Syncfusion.EJ.Export.GridExcelExport.<>c__DisplayClasse.<ProcessRecordRow>b__d(Column column)
       at System.Collections.Generic.List`1.ForEach(Action`1 action)
       at Syncfusion.EJ.Export.GridExcelExport.ProcessRecordRow(Object row)
       at Syncfusion.EJ.Export.GridExcelExport.RenderRecord()
       at Syncfusion.EJ.Export.GridExcelExport.ProcessGridContents()
       at Syncfusion.EJ.Export.GridExcelExport.IterateElements()
       at Syncfusion.EJ.Export.GridExcelExport.ExportHandler()
       at Syncfusion.EJ.Export.GridExcelExport.ExecuteResult(GridProperties GridModel, IEnumerable dataSource)
       at Syncfusion.EJ.Export.GridExcelExport.Export(GridProperties gridModel, IEnumerable dataSource, Boolean multipleExport)
       at Syncfusion.EJ.Export.ExcelExport.Export(GridProperties gridmaodel, IEnumerable datasource, String excelname, ExcelVersion excelversion, Boolean isHideColumnIncude, Boolean isTemplateColumnIclude, String theme)
       at EMIMReports._Default.dgReport_OnServerExcelExporting(Object sender, GridEventArgs e) in C:\Visual Studio Projects\2014\ESJS\EMIMReports\EMIMReports\Default.aspx.vb:line 99
       at Syncfusion.JavaScript.Web.Grid.PostBackEventHandler(String EventName, Dictionary`2 args)
       at Syncfusion.JavaScript.Web.CommonDataBoundControl.RaisePostBackEvent(String EventArgument)



The dataSource passed to the exporting method is compared with the Grid dataSource. Thus, when a column is not defined in the Grid dataSource, it is obtained as null value and hence throws a null exception.


You need to ensure that the columns bound to the Grid are defined in the Grid dataSource before exporting the Grid.

Article ID: Published Date: Last Revised Date: Platform: Control:
3018 12/10/2014 01/13/2015 ASP.NET Web Forms Grid
Did you find this information helpful?
theresa Dec 07, 2017

I ran into this problem and my columns were the same as the grid but did not solve the problem, what solved it was remove the filter. I was filtering the grid before export but the items in the controller have no filtering. ej Grid = 2 rows, datasource before the export is called have 4 rows, making the error appear. Once both have synchronized data, it started working.

Prasanna Kumar Viswanathan [Syncfusion] Dec 08, 2017

Hi Theresa,


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


1. Code example of a Grid and Controller.


2. Have you used foreignKey column in Grid?


3. Essential Studio Version details.


4. Share the business object model.  


5. If possible send me the issue reproduceable sample.  



Prasanna Kumar N.S.V

bruno roger stupp Jul 17, 2018

Recently a had the same problema, and my DataSource was complete, so for a log time I couldn't figure it out, it end up been a problem with the GridProperties.SummaryRows that for some reason had some information in it and, when resetted to new List, worked just fine.

Add Comment
You must log in to leave a comment

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