Stopping multiple postbacks ?

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
 
G

Guest

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
 
A

Adrian Parker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,600
Members
45,179
Latest member
pkhumanis73
Top