How do I stop users from clicking a button multiple times?

I have an old VB.NET web forms application that has a function that takes 30 seconds or so to run when a button is clicked. I need to prevent users from clicking the button multiple times while it is still processing.

Somehow disabling the button to prevent multiple submissions is the ideal for this application. How can I do this?

Harrison from Germantown.

One thought on “How do I stop users from clicking a button multiple times?

  1. Hello Harrison,

    This is a typical solution that is implemented in web development using Java script to disable the button. What you must do is add the following code in your buttons OnClientClick event:

    "this.disabled='true';return true;"

    It is important to note the bit of code “return true” because any code executed on the client-side must return true if the postback is to continue. It is a means of providing client-side validation on button presses.

Comments are closed.