Hi
I wondered if anyone knew of a "Pause" or "Delay" type piece of code I could use to delay a method execution within a method.
What I have is:-
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
MyShoppingCart usersShoppingCart = new MyShoppingCart();
String cartId = usersShoppingCart.GetShoppingCartId();
CheckOutHeader.InnerText = "Thank You - Your Order is Complete! Please wait whilst you are directed to PayPal...";
ImageButton1.Visible = false;
TotalAndOrderToPP(usersShoppingCart, cartId);
I ideally want some sort of pause or delay of say a second before the TotalAndOrderToPP is involked?
Regards
Steven
A pause in method needed before execution of another method
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted May 2, 2012, 8:40 AM EDT
System.Threading.Thread.Sleep(1000);
Guest UserRank #4,868 · 321 reputationPosted May 2, 2012, 9:41 AM EDT
Would this be placed before the required method is to be called, in this case the TotalAndOrderToPP method?
VulpesRank #55 · 29.2K reputationPosted May 2, 2012, 10:07 AM EDT
It will then suspend the thread for a second (1000 milliseconds) before that method is invoked.