Hi HeatherGebbia,
I suppose the following scenario:
1) place the button, hidden iframe and hidden progress indicator (span for example) into the form:
<asp:Button runat="server" ID="btn" OnClientClick="$get('ifr').src='var rnd=new Date();GetReport.aspx?rnd='+rnd;" /><iframe id="ifr" name="ifr" style="display:none"></iframe>
Here GetReport.aspx is the "second" page, that generated the report:
protected void Page_Load(object sender, EventArgs e)
{
Thread.Sleep(3000);
Response.ClearHeaders();
Response.ContentType = "application/octet-stream";
Response.AddHeader(
"content-disposition", "attachment; filename=MVCToolkit.zip");Response.WriteFile(Server.MapPath("~/MVCToolkit.zip"));
Response.End();
}
That's it
Now you should change the content type to desired one (I suppose pdf in your case)
BUT here you can not use Progress Indicator.
If you need progress indicator do the following (in more simple words):
1) Place a button in an UpdatePanel
2) User Clicks on Button and Ajax Progress Indicator simply shows that there is some work performing behids the scene
3) On the server generate report into temporary directory.
4) On the server after report is ready register startup script using ScritManager.RegisterStartupScript method, the script will change the src property of an hidden iframe and point it to the generated file.
5) on the browser user will see that progress interrupted - because asynchronous postback finished and returned, but immidiately executes javascript that pops up a save/open dialog.
Hope this helps