Pages

Subscribe:

Ads 468x60px

Wednesday, April 18, 2012

how to Disable Multiple Button Click in Asp.net using jquery, javascript and c#

In this web programming tutorial we will learn that How to make a button disable immediately when user clicks it in asp.net so that user cannot click multiple time.




Code for body section


Note: onclick event is calling javascript client-side function and onserverclick event is calling server-side function which performs actual task.
This task can be any as per your logic, for an example I am performing some heavy time consuming task, you can even make use of Threading concept to minimize code.
Server-Side Event to perform actual task
protected void Button1_Click(object sender, EventArgs e)
{
ArrayList a = new ArrayList();
for (int i = 0; i < 10000; i++)
{
for (int j = 0; j < 1000; j++)
{
a.Add(i.ToString() + j.ToString());
}
}
Response.Write("I am done: " +
DateTime.Now.ToLongTimeString());
}

1 comment:

Anonymous said...

I am looking for JQuery disable one.. but this solution is in javascript.. for jQuery button disable this may help you. http://aspnettutorialonline.blogspot.com/2012/05/how-to-disable-button-using-jquery-with.html

Post a Comment