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

Export to excel multiples grids in user controls

Thread ID:





121444 Dec 15,2015 05:45 PM UTC Dec 21,2015 07:03 AM UTC ASP.NET Web Forms 7
Tags: XlsIO
Asked On December 15, 2015 05:45 PM UTC


I've a page  that load a variable number of user controls. Each user control has a grid with its export function.

I need a button for export all data of all user controls. Each grid data must be in a different sheet.

I've develop a funtion that works fine while grid has data. When a grid has not data, the program breaks.

I attach an example code:

Annotations from the example

1. The UserControl has a public function for export the sheet from the main page
for (int i = 1; i <= 4; i++)
//for (int i = 1; i <= 3; i++)

If I change the comment and uncomment lines, the export works fine

Also, if I set an update panel, it doesn't work.

How can i do?


Attachment: WebApplication1_8a956eff.zip

Saravanan Arunachalam [Syncfusion]
Replied On December 16, 2015 01:50 PM UTC

Hi Manolo,

Thanks for contacting Syncfusion Support.

Query 1: When a grid has not data, the program breaks?

By analyzing your application, we found that 4th control’s name is set as an empty string. In ExportAll method, you have assigned the control’s name as worksheet name. As an empty string is assigned here, the exception is thrown. This is a usage level issue.

Query 2: If I set an update panel, it doesn't work.

If you render the control within the Update Panel, it caused an asynchronous postback. So, please use the “PostBackTrigger” to perform post back for the control in update panel. Please refer the below links to know about update panel.



Saravanan A.

Replied On December 16, 2015 04:47 PM UTC


In question1, I change  the function SetTitle to this:

public void SetTitle(string title)
      lblTitulo.Text = (String.IsNullOrEmpty(title)) ? "test" : title;

So, never will be an empty string, but I have the same problem

Dilli Babu Nandha Gopal [Syncfusion]
Replied On December 17, 2015 01:43 PM UTC

Hi Manolo

Thank you for updating us.

We are able to reproduce the issue “Thread is being aborted”, which is a known browser issue. This issue can be resolved by a workaround, where the file can be saved to a stream and the passing the stream to save as file by changing the response header.

We have shared a sample illustrating this for your reference, which can be downloaded from following link.

Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1929252905.zip

If you are facing any other issue, please share us the issue details to give you a prompt solution.

Dilli babu.

Replied On December 17, 2015 05:40 PM UTC


I've tried your solution, but in my code, it still continues  work wrong.

I've investigate, and I've found that after export and empty user control grid, the next grid break the program.

I attach an example

Attachment: WebApplication1929252905_2862b351.zip

Dilli Babu Nandha Gopal [Syncfusion]
Replied On December 18, 2015 09:06 AM UTC

Hi Manolo,

We were able to reproduce the problem and suspect this to be defect. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates


Please let me know if you have any questions.

Dilli babu

Replied On December 18, 2015 10:07 AM UTC

Ok, thanks!

Dilli Babu Nandha Gopal [Syncfusion]
Replied On December 21, 2015 07:03 AM UTC

Hi Manolo,
Thank you for updating us.
As mentioned earlier, you can follow up with the incident for further assistance regarding your query.
Dilli babu.


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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