Render to Excel - only one excel instance

Q

Q. John Chen

This is another one I posted at asp.net group a while ago.

I use following code to export the grid to Excel:

Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/ms-excel";
Response.Charset = "";
this.EnableViewState = false;

System.IO.StringWriter oStringWriter = new
System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new
System.Web.UI.HtmlTextWriter(oStringWriter);

this.ClearControls(dgDispatch);
dgDispatch.RenderControl(oHtmlTextWriter);

Response.Write(oStringWriter.ToString());

Response.End();

It works fine until -- I opened TWO IEs:

I start the first browser, query the database and then render the grid.
Fine.

I start the second browser, did a different query. then render the
grid. But it shows the result of the first browser. And more
interestingly, the content in the first browser is gone (Moved to the
second browser).

I tried give it a file name, tried set the expiration. But nothing
worked.

CLUE?

Thanks in advance.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top