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
close icon

Client side script is ignored after saving Excel

Hi,

I am saving error logs on an Excel file and let the user save it by using XlsIO.IWorkbook.SaveAs(...) function with the dialog. After that I create a script to display an alert window with an error message by using ScriptManager.RegisterClientScriptBlock(...) function. At the same time, I change a text control's text to display the error message as well. However, this script and text change are both ignored (not executed), and there is no postback either. Is there any reason why the code after the save is not working and there is no postback? Or is it my code?

-- Saving the excel workbook
objExcelWorkbook.SaveAs(strFile & ".xls", ExcelSaveType.SaveAsXLS, objResponse, ExcelDownloadType.PromptDialog)

-- Creating the script
ScriptManager.RegisterClientScriptBlock(pgPage, pgPage.GetType(), "Message", "window.alert(" & """" & strMessage.Replace(".", "").Replace(vbCrLf, " ") & """" & ");", True)

-- Changing text
With ctlError
.Text = strMessage
End With

(These 3 piece of code appear in different functions.)

Thanks in advance.





2 Replies

JJ Jawahar Jeevanandan J Syncfusion Team July 21, 2011 03:54 PM UTC

Hi Megumi,

Thank you very much for using syncfusion products.

Currently we are creating the samples using the information provided in the last post. We will get back with the analysis details in one business day(i.e., July 22 2011).

Please let us know if you have any clarifications.

Thanks,
Jawahar.



JJ Jawahar Jeevanandan J Syncfusion Team July 22, 2011 09:49 AM UTC

Hi Megumi,

Thank you very much for your patience.

It is the default behaviour of our XlsIO. While saving the file we will be closing the response inorder to avoid the threadabort exception thrown in the application level for excel 2007 and 2010. Similarly the response will be flushed for excel 2003.

We have added the custom method to meet your requirement.I have attached the tested sample for the same along with this update. Please try this sample and let us know whether this helps you.

Please let us know if you have any clarifications.

Thanks,
Jawahar.



SaveMethod_46643233.zip

Loader.
Live Chat Icon For mobile
Up arrow icon