- Home
- Forum
- ASP.NET Web Forms
- export to excel from grid
export to excel from grid
hi,
Attachment: error_f3234d7a.rar
i got error in export to excel from grid. when click excel button i got below error
"Object reference not set to an instance of an object."
plz help me
Attachment: error_f3234d7a.rar
SIGN IN To post a reply.
6 Replies
JK
Jayaprakash Kamaraj
Syncfusion Team
May 2, 2016 01:02 PM UTC
Hi Satheyaraaj,
Thanks for contacting Syncfusion support.
We were unable to reproduce the issue. But we suspect that the issue occurs when a column field is not defined in the Grid dataSource and obtained as null value, and hence throws a null exception.
Refer to the following knowledgebase document.
https://www.syncfusion.com/kb/3018/Null-Exception-while-exporting
https://www.syncfusion.com/kb/3018/Null-Exception-while-exporting
If you still face the issue, share the following information to find the cause of the issue.
1. Client side and server side full code example.
2. Are you performing any Grid operations like filtering\searching before exporting?
3. Essential studio version.
4. An issue reproducing sample if possible or sample hosted link or replicate the issue in the following sample.
Sample: http://www.syncfusion.com/downloads/support/forum/123889/ze/SyncfusionASPNETApplication292008918721
Regards,
Jayaprakash K.
SA
satheyaraaj
May 3, 2016 01:05 PM UTC
Hi,
Same error continues. im using Essential Studio Version.
Datasource Assign Code :
grdvwConrpt.DataSource = dt
grdvwConrpt.DataBind()
Hi Satheyaraaj,
Thanks for contacting Syncfusion support.
We were unable to reproduce the issue. But we suspect that the issue occurs when a column field is not defined in the Grid dataSource and obtained as null value, and hence throws a null exception.Refer to the following knowledgebase document.
https://www.syncfusion.com/kb/3018/Null-Exception-while-exporting
If you still face the issue, share the following information to find the cause of the issue.1. Client side and server side full code example.2. Are you performing any Grid operations like filtering\searching before exporting?3. Essential studio version.4. An issue reproducing sample if possible or sample hosted link or replicate the issue in the following sample.Sample: http://www.syncfusion.com/downloads/support/forum/123889/ze/SyncfusionASPNETApplication292008918721Regards,Jayaprakash K.
Hi,
Same error continues. im using Essential Studio Version.
Datasource Assign Code :
grdvwConrpt.DataSource = dt
grdvwConrpt.DataBind()
JK
Jayaprakash Kamaraj
Syncfusion Team
May 4, 2016 09:41 AM UTC
Hi Satheyaraaj,
Thanks for the update.
We suspect that you have bound dataTable as dataSource for the Grid, which is the cause of the reported issue. We have provided “DataTable support while exporting” from v14.1.0.41. So, if you are using older version, please upgrade to our latest version.
After doing the above, if the issue has still not resolved, please provide the following
1. Datatype of your dataSource
2. Ensure if you have referred the v14.1.0.41 dll’s, scripts and css in your sample project?
3. Grid rendering code and server side exporting code.
4. Issue reproducible sample or sample hosted link or replicate the issue in the attached sample.
We have created a sample, which can be downloaded from below location.
Sample: http://www.syncfusion.com/downloads/support/forum/123889/ze/SyncfusionASPNETApplication292078076954
Regards,
Jayaprakash K.
Hi Satheyaraaj,Thanks for the update.We suspect that you have bound dataTable as dataSource for the Grid, which is the cause of the reported issue. We have provided “DataTable support while exporting” from v14.1.0.41. So, if you are using older version, please upgrade to our latest version.After doing the above, if the issue has still not resolved, please provide the following1. Datatype of your dataSource2. Ensure if you have referred the v14.1.0.41 dll’s, scripts and css in your sample project?3. Grid rendering code and server side exporting code.4. Issue reproducible sample or sample hosted link or replicate the issue in the attached sample.We have created a sample, which can be downloaded from below location.Sample: http://www.syncfusion.com/downloads/support/forum/123889/ze/SyncfusionASPNETApplication292078076954Regards,Jayaprakash K.
Hi,
I'm using v14.1.0.41. i copied your sample code and use my project. but same error occurred.
note : im using master page.
my code :
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Page.IsPostBack = False Then
lssql = "SELECT * from Orders"
If dbConn.State = ConnectionState.Closed Then dbConn.Open()
cmdCStr = New SqlCommand(lssql, dbConn)
adapter.SelectCommand = cmdCStr
adapter.Fill(ds)
Grid1.DataSource = ds
Grid1.DataBind()
Response.Buffer = True
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1.0)
Response.Expires = -1500
Response.CacheControl = "no-cache"
End If
End Sub
Protected Sub FlatGrid_ServerExcelExporting(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs)
Dim exp As New ExcelExport()
exp.Export(Grid1.Model, DirectCast(Grid1.DataSource, DataTable), "Export.xlsx", ExcelVersion.Excel2010, True, True, "flat-lime")
End Sub
Protected Sub FlatGrid_ServerWordExporting(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs)
Dim exp As New WordExport()
exp.Export(Grid1.Model, DirectCast(Grid1.DataSource, DataTable), "Export.docx", True, True, "flat-lime")
End Sub
Protected Sub FlatGrid_ServerPdfExporting(sender As Object, e As Syncfusion.JavaScript.Web.GridEventArgs)
Dim exp As New PdfExport()
exp.Export(Grid1.Model, DirectCast(Grid1.DataSource, DataTable), "Export.pdf", True, True, "flat-lime")
End Sub
Thanks & Regards
Satheyaraaj PT
JK
Jayaprakash Kamaraj
Syncfusion Team
May 23, 2016 12:55 PM UTC
Hi Satheyaraaj,
We have created a sample with 14.1.0.41 version and we have used your codes in master page. But, mentioned issue is not reproducing at our end and we have attached video for your reference.
Sample: http://www.syncfusion.com/downloads/support/forum/123889/ze/SyncfusionASPNETApplication292042954722
If you are still facing the issue, please share the following:
1. please ensure you are referred 14.1.0.41 dll’s in your sample
2. given sample changed into issue reproducible.
Regards,
Jayaprakash K.
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
SA satheyaraaj
- Apr 29, 2016 07:47 AM UTC
- May 23, 2016 12:55 PM UTC