tags:

views:

55

answers:

3

In my ASP.NET MVC application, one of my actions is going to take a while -- it kicks off a sequence of other tasks. I'd like to report progress to the user. I want to display text -- I don't want a simple progress bar or spinner.

How should I go about doing the two parts? First, how do I display progress to the user? Second, how should I implement the action so that progress is available to the user?

+1  A: 

I started of writing a response but then I realized I should just redirect to the Progress Indicator AJAX pattern resource. It has a comprehensive yet concise discussion of the problems, solutions, usability considerations and other interesting details.

aleemb
Good answer from a usability point-of-view, but I was more looking at how to implement it on the server side...
Roger Lipscombe
@Roger, this is a client-side problem not a server-side one. So the client sends out an AJAX request and simultaneously displays a progress indicator. As soon as the server response comes back, it hides the progress indicator. There is nothing you really need to do on the server to enable this.
aleemb
+2  A: 

My ideas:

Create controller method, which returns JSON:

{
    "Message" : "Processing something serious",
    "Percentage" : "43"
}

Handle it through JS - put message span & bar indicator in seperated div, change it's content.

For progress bar i would use this one.

Arnis L.
+1  A: 

I'm doing some playing around, and currently I've got the following in mind:

  1. In the initial controller action, start a background thread that does the actual work, return immediately.
  2. In the web page, use a timer to query a "GetProgress" action. This'll return some JSON that can be used to update the web page. I'll be using jQuery.
  3. In the GetProgress action, query the background thread for its progress.

I'll probably pass a Job ID to GetProgress, and use this to identify which background thread I'm asking about.

Roger Lipscombe
sounds fine :) .
Arnis L.
Aah I see what you meant to do.
aleemb