jQuery and ASP.NET

February 23, 2009

How to do a Page PostBack With a Delay




Here's a simple way to delay a Page PostBack.

Add the following code in the Page_Load event:

C#


    protected void Page_Load(object sender, EventArgs e)


    {


        TimeSpan ts = new TimeSpan(0, 0, 0, 5);


        System.Threading.Thread.Sleep(ts);


    }




VB.NET


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)


        Dim ts As New TimeSpan(0, 0, 0, 5)


        System.Threading.Thread.Sleep(ts)


    End Sub





Note: Avoid using this approach too much in a Production environment.

'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

0 Responses to "How to do a Page PostBack With a Delay"
 

Copyright © 2009-2011 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions