massive process running in C# code behind after clicking a button.
What i needed to do was disable the button when
the user clicks the button.
So that the user cant double click the button and mess up the
The Registration took about 20 seconds to complete which was a major problem because
people testing it regularly double clicked the button destroying the registration process.
What I tried
event the C# onclick event wouldn't fire of the button.
so i needed a way to call the server side event.
My solution was as follows:
in C# code behind in Page_Load Event I put:
What the parameters means is as follows
btnRegister is my button ID.
The button code is as follows:
<asp:Button runat="server" ID="btnRegister" onclick="btnRegister_Click" Text="Book" Width="97px" OnClientClick="disableButton(this);" />
To enable button after post-back you can put in this code
and run it with
It looks easy but it took two days for me to find the solution.