Stopping multiple postbacks ?

  • Thread starter Thread starter Adrian Parker
  • Start date Start date
A

Adrian Parker

Say you have a webform with some fields and a button on it. When the user
clicks the button, the buttonclicked event gets fired on the server, it does
some processing, which includes creating some db records, and then redirects
the page. What is happening sometimes is that the server is a bit slow and
the page seems to sit there, so the user presses the button again, which
causes the server event to fire again, and so more records get created in
the DB. How can I stop the button firing an event once it has already done
so ?

Thanks
Adrian
 
Hi Parker,
Try to add a javascript function onClick to the button and
1)Hide the button on click in javascript like
document.getElementById("Button1").style.visibility = "hidden";(PS: this
script works in IE.)
2)Show some friendly text in the place of the button like "Processing..." so
that the user will not panic
 
Thanks srini, that works a treat!

srini said:
Hi Parker,
Try to add a javascript function onClick to the button and
1)Hide the button on click in javascript like
document.getElementById("Button1").style.visibility = "hidden";(PS: this
script works in IE.)
2)Show some friendly text in the place of the button like "Processing..."
so
that the user will not panic
 
Back
Top