We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

doc.Save("Test.doc"- SaveFormat.Doc- SaveType.OpenInWord- Response); does not work inside AJAX update panel button click event

I have a Microsoft AJAX2.0 Udate panel and a button inside the update panel. I have the following code in the button click event.

string srcFileName = @"d:\path\Test.doc"; //File path
Document doc = new Document(srcFileName); //new doc instance
doc.Range.Replace("Fname", TextBox8.Text, false, false); //replace Name
doc.Range.Replace("FAddress",TextBox9.Text, false, false); //replace address
doc.Range.Replace("FCity",TextBox10.Text, false, false); //replace city
doc.Range.Replace("FState",TextBox11.Text, false, false); //replace state
doc.Range.Replace("FZip",TextBox12.Text, false, false); //replace zip
doc.Save("DrugTestLetter.doc", SaveFormat.Doc, SaveType.OpenInWord, Response);

When I click the button I get the following message enclosed in a word document attachment in this table. I do not have this issue when I move the button outside of the Update panel.
Does this mean we can not use aspose inside an AJAX update panel so that we can avoid postback?


Thanks for your inquiry. Unfortunately you can’t use Response in UpdatePanel. I think that you can use IFRAME to achieve what you want.
Also see attached sample application. I hope this could help you.

Best regards.

Hi this Iframe example is not exactly useful. I just wnat to open a word document from an AJAX panel button click event. Can you please send me a sample code that exactly does this?

Appreciate your help. Please reply as soon as possible.


As I said earlier, you can’t use Response in Ajax UpdatePanel. You also will get this error if you try using Response.Write(“test”). So, I think that you can solve this problem using IFrame. For example you can try using the attached application.

I hope this could help.

Best regards.

I could not open the attachment from the Forum. It says attachment not accessible.

Can you please send the attachment as zip file to my email address?

My email address is ravi.ananta@yolocounty.org Please send the attachment file as soon as possible to this email. Appreciate your help


I sent demo app to your mail.

Best regards.