Updating a page before initiating a download?
<p>I've got a page that allows users to enter search criteria and then display matching records.  It also has a download button to enable the user to download matching records.  </p>

<p>How can I code it so that clicking on "Download" will first refresh the record display before downloading the data?</p>

<p>This is the code that I'm using for the download:</p>

<pre><code>Response.ClearContent();
Response.ClearHeaders();

using (MemoryStream outputStream = new MemoryStream())
{
    // some details elided...
    outputStream.Write(documentData, 0, documentData.Count());

    string fileName = GenerateFileName();

    Response.AppendHeader("content-disposition", String.Format("attachment; filename={0}", fileName));
    outputStream.Flush();
    outputStream.WriteTo(Response.OutputStream);
}
Response.Flush();
Response.Close();
</code></pre>
