Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > looping and displaying progress with every iteration

Reply
Thread Tools

looping and displaying progress with every iteration

 
 
Bruce Whitehouse
Guest
Posts: n/a
 
      11-22-2003
This should be an easy one, but I'm not sure the best way to do it.

I've got a form, and when I click a button it starts looping through an
array. With each iteration of the array I want it to change the status of a
label.

I realise that it must complete the execution of the code-behind page before
it can update the labels, so how do I do it?

TIA, Bruce


 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      11-22-2003
I have a couple of approaches on my website tackling this. Essentially, you
want to create a progress bar of sorts.

http://www.networkip.net/tidbits/splash.htm

Regards

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
news:#kZ$(E-Mail Removed)...
> This should be an easy one, but I'm not sure the best way to do it.
>
> I've got a form, and when I click a button it starts looping through an
> array. With each iteration of the array I want it to change the status of

a
> label.
>
> I realise that it must complete the execution of the code-behind page

before
> it can update the labels, so how do I do it?
>
> TIA, Bruce
>
>



 
Reply With Quote
 
 
 
 
Bruce Whitehouse
Guest
Posts: n/a
 
      11-23-2003
Thanks Alvin

What I was wanting to do was loop through some code in my VB (code behind
page). The loop is actually going through 15 or so web services (which take
up to 2 minutes each), so on each iteration of the loop (for each
webservice) I wanted to let the user know what the status was of each web
service call.

I'm about to re-write the page using an array and a datagrid. I'll be
letting the page complete, checking for what is to happen next, execute the
method, update label, let page reload, etc, etc.

So I can't have the page reload every 2 seconds. Firstly because the web
service method that I'm calling returns a true value, and I have to wait for
it to be returned.

Bruce



"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:(E-Mail Removed)...
> I have a couple of approaches on my website tackling this. Essentially,

you
> want to create a progress bar of sorts.
>
> http://www.networkip.net/tidbits/splash.htm
>
> Regards
>
> --
>
>
> -----------
> Got TidBits?
> Get it here: www.networkip.net/tidbits
> "Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
> news:#kZ$(E-Mail Removed)...
> > This should be an easy one, but I'm not sure the best way to do it.
> >
> > I've got a form, and when I click a button it starts looping through an
> > array. With each iteration of the array I want it to change the status

of
> a
> > label.
> >
> > I realise that it must complete the execution of the code-behind page

> before
> > it can update the labels, so how do I do it?
> >
> > TIA, Bruce
> >
> >

>
>



 
Reply With Quote
 
Alvin Bruney
Guest
Posts: n/a
 
      11-23-2003
Understood, but you are missing something here. You will need a refresh to
update the client with whatever happens on the server. If you don't refresh
there is no possible way of notifying the client that you are making
progress because your main process cannot update the client while it is
polling the webservices.

On each refresh you will need to read a variable which tells you the
percentage completion, typically stored in session or viewstate. This
variable is set by your procedure which iterates over the webservices. So
for example, as you pass thru each webservice and you retrieve a request,
your percentage complete becomes x/15 * 100. You set that viewstate
variable. At this point, you force an immediate screen refresh. But your
code moves on in the iteration. The refresh updates the client with the
percentage completed. This algorithm persists until all the iteration is
done.

Alternatively, if the output of each webservice is not dependent on the next
webservice call, I suggest you thread the application. For example, if you
spawned five threads, each thread queries 3 webservices all done at the same
time, you can potentially improve performance 5 fold because each thread
will be executing at roughly the same time (more or less).

Put another way, if you send your son to town to get the morning paper, you
cannot have the paper until he comes back. You will be left waiting for as
long as he takes to get the paper. On the other hand if you send him with
his sister (threading) and periodically, his sister leaves him in town to
come back to let you know what is happening, you receive valuable updates
and your wait time is 'easier'.

Regards

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
news:#(E-Mail Removed)...
> Thanks Alvin
>
> What I was wanting to do was loop through some code in my VB (code behind
> page). The loop is actually going through 15 or so web services (which

take
> up to 2 minutes each), so on each iteration of the loop (for each
> webservice) I wanted to let the user know what the status was of each web
> service call.
>
> I'm about to re-write the page using an array and a datagrid. I'll be
> letting the page complete, checking for what is to happen next, execute

the
> method, update label, let page reload, etc, etc.
>
> So I can't have the page reload every 2 seconds. Firstly because the web
> service method that I'm calling returns a true value, and I have to wait

for
> it to be returned.
>
> Bruce
>
>
>
> "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
> message news:(E-Mail Removed)...
> > I have a couple of approaches on my website tackling this. Essentially,

> you
> > want to create a progress bar of sorts.
> >
> > http://www.networkip.net/tidbits/splash.htm
> >
> > Regards
> >
> > --
> >
> >
> > -----------
> > Got TidBits?
> > Get it here: www.networkip.net/tidbits
> > "Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
> > news:#kZ$(E-Mail Removed)...
> > > This should be an easy one, but I'm not sure the best way to do it.
> > >
> > > I've got a form, and when I click a button it starts looping through

an
> > > array. With each iteration of the array I want it to change the

status
> of
> > a
> > > label.
> > >
> > > I realise that it must complete the execution of the code-behind page

> > before
> > > it can update the labels, so how do I do it?
> > >
> > > TIA, Bruce
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
looping in array vs looping in a dic giuseppe.amatulli@gmail.com Python 5 09-20-2012 11:58 PM
Struts - Problem with nested iteration or double iteration Rudi Java 5 10-01-2008 03:30 AM
looping every few minutes Mithil Java 3 05-18-2007 11:49 AM
Progress bar to show the progress of a task Charlie Zhang Java 3 08-16-2004 05:53 PM
looping every x seconds kernal32 Perl Misc 7 12-26-2003 11:32 PM



Advertisments