shahjagat
asked on
Alert message - Pause for loop
Hi,
I am looping through a datatable. For each row in the datatable, after executing set of commands, I want an alert message to be displayed. I am using thread.sleep(5000). It does not display the message till it completes the for loop. Once the for loop completes, it displays all the messages one after another.
Is there a way to pause the loop, display message and the ncontinue the loop?
Thank you.
I am looping through a datatable. For each row in the datatable, after executing set of commands, I want an alert message to be displayed. I am using thread.sleep(5000). It does not display the message till it completes the for loop. Once the for loop completes, it displays all the messages one after another.
Is there a way to pause the loop, display message and the ncontinue the loop?
Thank you.
for i =0 to dt.rows.count -1
'execute my code here
If Not (closerid = 0) Then
RadAjaxManager1.Alert(lastNm & ", " & firstNm & " is assigned to " & rName)
Threading.Thread.Sleep(5000)
ObjSched.BLL_Updatemytable(closerid, newpid)
End If
Next
Hi,
You can use delegates/events for this purpose.
Just create a event handler and raise the event from the code.
if you are using vb.net in winform plateform then you can use DoEvents() method
Pleasse review following for more details:
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx
Thanks
You can use delegates/events for this purpose.
Just create a event handler and raise the event from the code.
if you are using vb.net in winform plateform then you can use DoEvents() method
Pleasse review following for more details:
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx
Thanks
As he's using ajax I'm pretty sure it's for a ASP .Net application, so the above post wouldn't apply, but will leave it up to the OP to confirm.
ASKER
ged325,
Yes, it is ASP.Net application.
In the for loop, i am looping through client records and when each one is processed, i am showing a message , that the record for that client is processed
Yes, it is ASP.Net application.
In the for loop, i am looping through client records and when each one is processed, i am showing a message , that the record for that client is processed
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
The only way to really do this is to
1) Create a web service which will return the latest message
2) Add a timer to your page
3) On the timer tick event, invoke web service pulling latest message and updating it via ajax.
The loop will then write the status (most likely to the DB as the session isn't available in the web service)
If you're pausing for 5 seconds, set the timer for 3 seconds ot poll the web service.