Dec 30, 2010

How to Disable the Submit Button and also run server code

If you want to prevent multiple clicks on a form submit button, disable the button.
It’s easy, simple. I’ll show you exactly how to do it.
Simply add the  in the page load

btnSubmit.Attributes.Add("onclick", ("javascript:" + btnSubmit.ClientID + ".disabled=true;") + Page.ClientScript.GetPostBackEventReference(btnSubmit, ""));

No comments:

Post a Comment