AJAX and progress

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

I know im coming to this party really late, but I have finally beein
expiramenting with AJAX on some ASP development. I seem to have things
working the way I want with one exception. I have a button that fires server
side code for the on-click event. This process time is variable, and I need
to be able to show the user a wait time or at least an updating status as to
the stage of processing (not just a silly non-dyanamic graphic that every
tutorial wants to show).

Inside the server side event, I figured I would just add items to a AJAX
enabled listbox to give the user an idea of where the processing is currently
at. (Started...Working..xxxx # of records processed, finalizing.., etc).
I've added the code to add the items at various stages of the processing, and
figured that databinding the listbox control located in an update panel would
show the items. Unfortunately, that's now the result i get. Until the
button's event completely finishes, the listbox control (located in a
separate update panel) does not update (and of course then I get all the
statuses at once...). Waiting until the end of the function to interact with
the user is what I was trying to avoid.

Am I missing something obvious? I assume I could call an async function
inside the buttons on click event, and then have an AJAX control on the page
poll a db for a status, but I don't think it should be that hard. Can
someone help point me in the right direction?

Thanks! -Matt
 
you are correct, you need to poll. the update panel works by sending
all the formdata to the server, running the page process, then sending
back the html to render in the update panels. also the ajax poll needs
to not use session, as session requests are processed serially.

-- bruce (sqlwork.com)
 
Actually my suggestion is of no use if you want to the "stage of processing".
Not sure how you are going to know that.
 
Well, AJAX does have the UpdateProgress control but configuring that will
depend on HOW you are progerssing through the stages and show the state (how
do you know what stage r u at??). You can, however, create andother thread
which will keep adding some seconds to the progress and display it on the
page, thus de-coupling the CLick event of button from progress display.
 
Back
Top