M
MJP
I have a button which kicks off the generation of a report after which
the file will be downloaded. The report generation can take a long
time, so client side onclick event of the button also makes a <span>
tag visible which contains a nice message to the user thanking them
for their patience. Of course after the report has been generated and
downloaded this message should be removed. However, the
RegisterStartupScript isn't working after calling Response.WriteFile.
Any alternative solutions/suggestions to solve this issue?
Code:
protected void btnExecute_Click(object sender, System.EventArgs e)
{
CreateReport();
Response.AppendHeader("content-disposition", "attachment;
filename=<filename>");
Response.WriteFile(<filename>);
Response.Flush();
Page.RegisterStartupScript("ToggleWait",
"<script>javascript:spnMessage.style.display = \"none\";</script>");
}
the file will be downloaded. The report generation can take a long
time, so client side onclick event of the button also makes a <span>
tag visible which contains a nice message to the user thanking them
for their patience. Of course after the report has been generated and
downloaded this message should be removed. However, the
RegisterStartupScript isn't working after calling Response.WriteFile.
Any alternative solutions/suggestions to solve this issue?
Code:
protected void btnExecute_Click(object sender, System.EventArgs e)
{
CreateReport();
Response.AppendHeader("content-disposition", "attachment;
filename=<filename>");
Response.WriteFile(<filename>);
Response.Flush();
Page.RegisterStartupScript("ToggleWait",
"<script>javascript:spnMessage.style.display = \"none\";</script>");
}