I could not find a way of displaying a please wait page while doing an async operation;
What I am trying to implement is a search page which displays 'please wait' animation while the search operation is being done by an async thread.
I am pasting the simple test code I implemented below. The initial "Searching" view is never displayed even though debugger goes through that line. I only see the final 'Results' view after the operation is complete;
public class HomeController : AsyncController
{
public ActionResult Search()
{
// Add an asynchronous operation
AsyncManager.OutstandingOperations.Increment();
ThreadPool.QueueUserWorkItem(o =>
{
Thread.Sleep(5000);
AsyncManager.OutstandingOperations.Decrement();
}, null);
return View("Searching");
}
public ActionResult SearchCompleted() {
return View("Results");
}
}