title: MVC3 - File Download - Wait Status indicator
body: <p>Ok, I've done my homework and have found similar threads. However, I haven't found a good answer.</p>
  
  <p>Using MVC3, C#, Razor View Engine.</p>
  
  <p>My scenario is pretty straightforward. I have a view with a link that calls an action on a controller. That action returns a file that was dynamically generated. The process takes anywhere from 1 to 10 seconds. During this time I want to lock the UI and display a "Please Waite" message. </p>
  
  <p>My first attempt  used something like this:</p>
  
  <pre><code>@Ajax.ActionLink("my test link", "myAction", new { Controller = "myController" }, new AjaxOptions { OnBegin = "ajaxStart", OnComplete = "ajaxStop" }) 
  </code></pre>
  
  <p>The ajaxStart and ajaxStop functions then used the jquery blockUI script to block and unblock the UI and display the "Please Wait" message. This worked in that it showed the message, but no file would download. After some more research, I found that I could not use Ajax to initiate a file download. If I'm wrong, please enlighten me.</p>
  
  <p>So, I'm back to a normal ActionLink. This works in that I can download a file. I can even catch the .click event and block the UI and show the wait message. However, how do I know when to unblock the UI? How can I know when the file save/open dialog has opened up? Perhaps if I could catch that event I could then unblock the UI.</p>
  
  <p>I have seen the other posts that recommend a much more complex solution by breaking the file generation/download into separate functionality. I very much want to avoid having to save the file on the server,  or having to poll the server to see if the file is done yet.  This should be fairly simple.</p>
  
  <p>If anyone has any ideas, please let me know.</p>
  
  <p>Thanks,
  Tony</p>