By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

Regarding double page loading

P: 1
Hi all

I have a problem I've been working at the few past days. I want to export a string in an excel format and in the meantime reload the page I'm at.

The only thing I try do do is to disable the "Export" button when clicked because my export can take a long time. Once the export finished I'd want the button to return to enabled=true. The easier way to do it is to reload the page and there is my problem.

Here's part of my code :

BtnESearch.Attributes.Add("OnClick","_ctl0_BtnESea rch.value='"
+ "Please Wait" +
"';window.setTimeout('document.Form1._ctl0_BtnESea rch.disabled=true;',0)");

<BtnESearch_Click> // The Export Button
string fileName = "Export_EXCEL.xls";
Response.BufferOutput = true;
Response.AddHeader("Content-Disposition","attachment; filename="+fileName);
Response.Charset = "";
StringWriter wr = new StringWriter();
Response.Write(v_convRateList.ExportExcel()); // The export
RaiseEvent ... // Reload the page

The problem is, if I reload my page after the export, this one display in excel. That's quite logic but I've not managed to avoid that.
I've tried all sorts of ways to avoid it (changing Response attributes, prerender, javascript...) but the "Response.End()" seems to affect badly all my options and I couldn't avoid it.

If someone have any idea, thanks in advance. I've been searching a long time on the Internet but only the Datagrid export seems to be used ^^
Sep 7 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 4,871
If the export is performing poorly, it may pay to try a different method:
How To Query and Display Excel Data by Using ASP.NET, ADO.NET, and Visual Basic .NET
Sep 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.