to Excel

Q

Q. John Chen

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top