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.


Thread ID:





124887 Jul 6,2016 07:20 AM Jul 8,2016 08:24 AM ASP.NET Web Forms 3
Tags: Grid
Hrvoje Voda
Asked On July 6, 2016 07:20 AM

IS there a way to use custom button to export data to excel?
I'm using this code but it doesn't work.

 Dim exp As New ExcelExport()

 exp.Export(grd.Model, grd.DataSource, "Materijali.xls", ExcelVersion.Excel2013)

When I decode grd.DataSource it's empty.

The same thing is for PDF export.

Jayaprakash Kamaraj [Syncfusion]
Replied On July 7, 2016 05:04 AM

Hi Hrvoje, 

Thank you for contacting Syncfusion support. 

We have already discussed the same in following knowledge base document. 


Jayaprakash K. 

Hrvoje Voda
Replied On July 7, 2016 06:21 AM

I tried that code, but I'm getting an error:
Object cannot be cast from DBNull to other types

Jayaprakash Kamaraj [Syncfusion]
Replied On July 8, 2016 08:24 AM

Hi Hrvoje, 

We have created a sample with custom button to export grid data. Please refer to the below link.    

The Null exception issue may occur in any of the below scenarios.   
1.       If the DataSource of the Grid is DataTable   
2.       If the columns defined in grid is not present in the DataSource.   
Please refer to the following knowledge base document.


Also, we have provided “DataTable Support for exporting” from v14.1.0.41. So if you are using older version, please upgrade to the new version.   
If the issue has still not resolved, please provide the following details,  
1.       Is there any script error or exception thrown in your project? If so, attach a screenshot of your stack trace.      
2.       Share the video to show the issue. 
3.       Essential studio version details.  
4.       Browser details.   
5.       Issue replication procedure. 
6.       Did you export DataTable?   


Jayaprakash K. 


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.