473,241 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

Disable button to prevent double clicking

If I put client side code to disable a button (so that a user doesn't click
it twice and double post the form) then teh button doesn't get posted with
the form and the button's server-side click event handler is not fired.
Seems like a big hole in the ASP.NET form handling process. Any way around
it and still use the button click event handler?
--Buddy
Feb 27 '06 #1
4 8998
Hi,

You can keep a image and the button in the same div tag. Initially, make the
button visible and the image invisible. And when the user clicks the button
then hide the button and make the image visible. So in this situation user
will not be able to click the button twice and your problem will get solved.

Regards,
Parag Kulkarni
MTS | Persistent Systems Private Limited

"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:e9*************@TK2MSFTNGP11.phx.gbl...
If I put client side code to disable a button (so that a user doesn't
click
it twice and double post the form) then teh button doesn't get posted with
the form and the button's server-side click event handler is not fired.
Seems like a big hole in the ASP.NET form handling process. Any way
around
it and still use the button click event handler?
--Buddy

Feb 27 '06 #2
Post you client-side event handler.

Eliyahu

"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:e9*************@TK2MSFTNGP11.phx.gbl...
If I put client side code to disable a button (so that a user doesn't
click
it twice and double post the form) then teh button doesn't get posted with
the form and the button's server-side click event handler is not fired.
Seems like a big hole in the ASP.NET form handling process. Any way
around
it and still use the button click event handler?
--Buddy

Feb 27 '06 #3
Buddy,

I built a javascript component that I give away for free (with source code).
One of the scripts in the component does exactly what you're attempting
here. You can see a sample and download the code from here:
http://www.aboutfortunate.com?page=javascriptdemo. You'll be interested in
demo# 3.

One thing that the code does is to call .NET's own javascript for checking
page validity before disabling the button. That way if a form isn't valid
the button doesn't get disabled which would strand the user.

If you have any questions let me know. The code is currently written for
..net 1.1 but is easily upgraded. If you're using 2.0 and have any difficulty
upgrading the code yourself let me know and I'll give you a hand. I just
haven't gotten around to posting updated code to my site yet.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:e9*************@TK2MSFTNGP11.phx.gbl...
If I put client side code to disable a button (so that a user doesn't
click
it twice and double post the form) then teh button doesn't get posted with
the form and the button's server-side click event handler is not fired.
Seems like a big hole in the ASP.NET form handling process. Any way
around
it and still use the button click event handler?
--Buddy

Feb 27 '06 #4
<INPUT id="myButton" onclick="document.form1.myButton.disabled=true;"
type="button" value="Submit" name="myButton" runat="server"
onserverclick="myButton_Click">

The button will disable itself on click, and run the sub of your
choice.

Hope it helps,
Jeremy Reid
http://hgtit.com

Feb 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: n00m | last post by:
When I double-click on "some.py" file console window appears just for a moment and right after that it's closed. If this script is started from inside of IDLE (F5 key) then it executes as it should...
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
2
by: Jason | last post by:
Is there a way to not allow users to click server button more than once or double clicking it besides trying to disable it in the code behind the first time it is clicked?
1
by: Aubyone | last post by:
Does any one know if there is a way to disable Button on the web page while the page is proceessing the command on the Server? To stop user clicking buttons once it has started a process.
0
by: Michiel Rapati-Kekkonen | last post by:
Hi, I just upgraded to 2007. It is quite a change in interface, but, on one of my computers double-clicking a table or a form or any other object in the navigationwindow doesn't open them....
3
by: Donald A. Fisher | last post by:
Hello. I've been working a vb project and have a form with a button on it that performs some actions after disabling the button when clicked: Code disabling button and starting actions: Private...
3
parshupooja
by: parshupooja | last post by:
Hey all, I have button on page. OnClick event I am saving records to database, which takes couple of seconds, meanwhile if user becomes impatient and clicks again, it triggers save again. I want...
6
patjones
by: patjones | last post by:
Sometimes you might have two list boxes side by side, and want to double-click on an item in one box to move it to the other. For instance, maybe the first list box contains a list of customers,...
2
by: Tom | last post by:
Double clicking the title bar to toggle a form between full screen size and the previous size is a great feature. Can someone please explain how to programmatically double click the title bar? ...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.