Nate Pet
Nate Pet

Reputation: 46322

ASP.NET disable double click

I have a page where the user can enter data and on submit, it shows up on a gridview right below it.

How do I prevent double click. I understand I can disable the button but that would defeat the purpose as then, the user cannot enter more information without refreshing the page.

Upvotes: 1

Views: 1589

Answers (2)

Parker
Parker

Reputation: 1102

You could always disable the button and then use setTimeout to re-enable the button after second or two: http://jsfiddle.net/BJKy4/

$("#btn").click(function () {
   var button = $(this);
    button.prop('disabled', true);
    setTimeout(function () {
        button.prop('disabled', false);
    }, 1000);
});

Upvotes: 1

Ben Anderson
Ben Anderson

Reputation: 7353

I add a class to all elements I dont want the ability to add a double click

$('.disableDoubleClick').dblclick(function(e){ 
    e.preventDefault();
})

this question has been answered many times, just google disabling double clicking in asp.net

Upvotes: 2

Related Questions