Last post Dec 11, 2013 02:51 PM by Rion Williams
Dec 11, 2013 01:47 PM|pvong|LINK
I'm running a simple test. These are my codes:
Image1.Visible = True
BankImportStatusL.Text = "Done"
Image1 is just the spinning circle telling the user it's doing something. I just want this image to be visible and spin for 5 sec and then my Label come back with a done.
When I click the buttong, the browser does wait the 5 sec but my image never appears with the spinning wheel. After 5 sec, I get both the spinning wheel and the message at the same time.
I want the wheel first for 5 sec and then the message.
Dec 11, 2013 01:55 PM|Siva Krishna Macha|LINK
Basically it is the server side code you have written above three lines.
The server sends the response back to the browser 'after processing all the code written on server side'.
So, setting properties of image, waiting for 5 seconds, and setting text for label - all will be over - and only after that, the server sends the HTML response back to the client and so you see that behavior.
I don't think if there is a way for normal ASP.NET pages for this behavior in an easy manner.
Dec 11, 2013 01:59 PM|PatriceSc|LINK
Keep in mind that this code runs server side. So your code runs, wait 5 s, change the label value. Then when your code ends the whole control hierarchy is rendered as an HTML page that is sent to the browser and then rendered.
Some context could help. Do you want a general mechanism on all your pages ? Is this for an AJAX call ? etc...
Generally this is the previous page that shows a message when you start loading the next one...
Dec 11, 2013 02:14 PM|pvong|LINK
Thanks for the quick reply. Basically, this is what is really going on.
On Button click, it's telling my SQL to execute a SSIS package and then it's doing a quick test against the table to see if there are any records. It then tells the user if there are records or no records. The problem is that the button tells SQL to execute
and then it goes straight into my test before the SSIS package can complete so it always comes back as no records even though after 5 seconds there are 100s of records. I was trying to put a pause in between the two processes so it can complete before it
runs the test. I wanted the spinning circle just so the user knows it's doing something. I'll take any ideas on how to better handle this process if you have any ideas.
As for the Java - I'm a newbie and haven't really played with Java. Can someone show me how to write a simple java script and then what I would write in OnClick to launch the Java that will launch the spinning circle?
Anything you can do to help a newbie is greatly appreciated.
Dec 11, 2013 02:22 PM|A2H|LINK
Check the below link
Dec 11, 2013 02:51 PM|Rion Williams|LINK
You may want to consider handling this purely client-side if that is an option (or consider using an AJAX request to perform your operation) as opposed to attempting to use the Thread.Sleep() method which will simply wait for five seconds prior
to actually finishing any of the code in your code behind.
This is how your existing code would execute :