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.

Client side script is ignored after saving Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

100264 Jul 20,2011 04:01 PM Jul 22,2011 05:49 AM ASP.NET Web Forms (Classic) 2
loading
Tags: XlsIO
Megumi Takahashi
Asked On July 20, 2011 04:01 PM

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.





Jawahar Jeevanandan J [Syncfusion]
Replied On July 21, 2011 11:54 AM

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.


Jawahar Jeevanandan J [Syncfusion]
Replied On July 22, 2011 05:49 AM

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

CONFIRMATION

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.

;