Avoid click of a button twice

This is a very common requirement that the user should not click on the button twice while submitting. The best option to use the below code on the page load

PostBackOptions pbOptions = new PostBackOptions(btnSave);
btnSave.OnClientClick = "this.disabled = true; this.style.cursor='wait';";
btnSave.OnClientClick += Page.ClientScript.GetPostBackEventReference(pbOptions);

If you are using a Image button, instead of this use the document.getElementById('ctl00_btnSave')

Hope this helps..

Cheers!!!

Comments

Popular posts from this blog

Jesus - God Thinks of you.

ASP.NET 4.0 Feature - URL Routing

Tips on JQuery Intellisense in VS 2008