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 to excel multiples grids in user controls

Hi,

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
2.
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?

Thanks

Attachment: WebApplication1_8a956eff.zip

7 Replies

SA Saravanan Arunachalam Syncfusion Team 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.

http://stackoverflow.com/questions/22190957/update-panel-postbacktrigger-update-progress-not-displaying


Regards,

Saravanan A.



MA Manolo December 16, 2015 04:47 PM UTC

Hi,

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


DB Dilli Babu Nandha Gopal Syncfusion Team 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.

Regards,
Dilli babu.


MA Manolo December 17, 2015 05:40 PM UTC

Hi!

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


DB Dilli Babu Nandha Gopal Syncfusion Team 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

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,
Dilli babu


MA Manolo December 18, 2015 10:07 AM UTC

Ok, thanks!


DB Dilli Babu Nandha Gopal Syncfusion Team 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.
 
Regards,
Dilli babu.

Loader.
Up arrow icon