G
Guest
Guys,
I have a three frame frameset: a title bar at top, a menu bar on the left, and a "main" frame where the business logic happens.
On one page, I need to offer an "Export to Excel" button. When I click this button the download happens, but then the menu bar appears to freeze. What happens is that the page selected is created and sent, but the page offering "Export to Excel" is just redisplayed, so nothing appears to happen.
The above problem only occurs if I save the CSV file to disk. Displaying in Excel with the "Open" option does not cause this.
My code is below:
Response.Buffer = true;
Response.ContentType = "text/plain";
Response.AddHeader("Content-Disposition", "attachment; filename=MyFile.csv");
string FileContents = "Number,Again\r\n";
for (int ctr = 1; ctr <= 10; ctr++)
{
FileContents += ctr.ToString() + "," + ctr.ToString() + "\r\n";
}
Response.Write(FileContents);
Response.Flush();
Response.SuppressContent();
Response.End();
Thanks,
Simon.
I have a three frame frameset: a title bar at top, a menu bar on the left, and a "main" frame where the business logic happens.
On one page, I need to offer an "Export to Excel" button. When I click this button the download happens, but then the menu bar appears to freeze. What happens is that the page selected is created and sent, but the page offering "Export to Excel" is just redisplayed, so nothing appears to happen.
The above problem only occurs if I save the CSV file to disk. Displaying in Excel with the "Open" option does not cause this.
My code is below:
Response.Buffer = true;
Response.ContentType = "text/plain";
Response.AddHeader("Content-Disposition", "attachment; filename=MyFile.csv");
string FileContents = "Number,Again\r\n";
for (int ctr = 1; ctr <= 10; ctr++)
{
FileContents += ctr.ToString() + "," + ctr.ToString() + "\r\n";
}
Response.Write(FileContents);
Response.Flush();
Response.SuppressContent();
Response.End();
Thanks,
Simon.