Informing client of progress via code-behind

  • Thread starter Thread starter MarkusJ_NZ
  • Start date Start date
M

MarkusJ_NZ

Hi, I have a website where a person can upload a CSV and all the
records are displayed in a gridview.

If the records are correct then I iterate through each row and create
a business object for each row and save the record to the database;
this is working fine.

My problem is that the client has no idea about the progress or how
many records have been saved or are left to save to the database.

What I would like to do is each time the .Save() method is called on
my business object show a message via the users browser that "Record
Joe Bloggs has been saved to the database."

I would also like to be able to do this if a person uploads a CSV and
I bind this CSV to a datatable (e.g. no datagrid). In this instance, I
would just iterate through the datatable saving records and showing
the progress to the user.

Any ideas welcome
Regards
Markus
 
The thing to remember is that the browser receives messages from the server
AFTER the server is done processing the page and its code. The only way you
are going to be able to give the browser progress reports is by having the
client download and install some time of upload manager, which would
essentially be a client application.

-Scott
 
The thing to remember is that the browser receives messages from the server
AFTER the server is done processing the page and its code.  The only way you
are going to be able to give the browser progress reports is by having the
client download and install some time of upload manager, which would
essentially be a client application.

-Scott











- Show quoted text -

Hi Scott, yes, I thought as much, thanks for your help

Regards
Markus
 
Hi Scott, yes, I thought as much, thanks for your help

Regards
Markus

There are ways to do this it depends on how much you want to change
your app.
You could have a status table in your database where your process
periodically writes what it is doing.
Then you could have a button on your page that a user can press that
would cause the page to read the status.
On completion the page could just redirect to the page you want the
user to see when the app is completed.
You can use the javascript settimeout, or ajax to automatically
refresh the page at certain intervals.
 
Back
Top