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

Export

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.

3 Replies

JK Jayaprakash Kamaraj Syncfusion Team July 7, 2016 09:04 AM UTC

Hi Hrvoje, 

Thank you for contacting Syncfusion support. 

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



Regards, 

Jayaprakash K. 



HV Hrvoje Voda July 7, 2016 10:21 AM UTC

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


JK Jayaprakash Kamaraj Syncfusion Team July 8, 2016 12:24 PM UTC

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.

https://www.syncfusion.com/kb/3018/Null-Exception-while-exporting  

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?   

Regards, 

Jayaprakash K. 


Loader.
Live Chat Icon For mobile
Up arrow icon