tags:

views:

37

answers:

1

I use

response.AddHeader("content-disposition", "attachment;filename=file.xls");
response.ContentType = "application/vnd.ms-excel";

as a method to generate a CSV/Excel file in my page. It works like a charm, however, after I open the file, the scripts on my page are unresponsive; trying tie JS onclick on any component on my page dosen't work.

Any Ideas/suggestions???

A: 

The root cause is the Content Type.

Javascript only works with certain combinations of ContentType ... of which 'js' itself must be a part. Try reverting ContentType dynamically to JS compatible type.

Shankar Ramachandran