Using the wizard control - cannot use Response.Write
Posted on 2007-11-27
I have an export routine as follows that works great on an aspx web form. Essentially a datareader is exported to a csv file with ability to download file onto desktop.
Here is the code snippet.
using (StringWriter sw1 = new StringWriter(sb1))
sw1.Write(thisReader.GetName(4) + "," + thisReader.GetName(5) + "," + thisReader.GetName(7));
sw1.WriteLine(thisReader["FirstName"] + "," + thisReader["LastName"] + "," + thisReader["Address1"]);
Response.AddHeader("content-disposition", "attachment;filename=" + filename);
Now if I put this code as part of a wizard control - I don't get the popup save dialog box. How can I fix this?