473,662 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Button click once

Hi All,
I'm trying to create a button that once clicked will disable itself (so as
not to be clicked twice)

I have the following in my cs
Button1.Attribu tes.Add("onClic k","return
document.Form1. Button1.disable d=true;");

It disables the button but does not perform the post back. What am I doing
wrong?

If I remove the line it posts back fine.

Thanks
Jon

Nov 18 '05 #1
5 3484
Hi
Place button1.enabled = false on the button click event. This will disable
the button after postback, because, the click event is only processed after
postback. Thanks
Ibrahim

"Jon Booth" wrote:
Hi All,
I'm trying to create a button that once clicked will disable itself (so as
not to be clicked twice)

I have the following in my cs
Button1.Attribu tes.Add("onClic k","return
document.Form1. Button1.disable d=true;");

It disables the button but does not perform the post back. What am I doing
wrong?

If I remove the line it posts back fine.

Thanks
Jon

Nov 18 '05 #2
Jos
Jon Booth wrote:
Hi All,
I'm trying to create a button that once clicked will disable itself
(so as not to be clicked twice)

I have the following in my cs
Button1.Attribu tes.Add("onClic k","return
document.Form1. Button1.disable d=true;");

It disables the button but does not perform the post back. What am I
doing wrong?

If I remove the line it posts back fine.


It disables the button before the actual postback, which is hence aborted.

I saw a similar post a few weeks ago, and I remember that
one of the solutions was to use visibility instead of disabled.
(document.Form1 .Button1.style. visibility='hid den';).

--

Jos
Nov 18 '05 #3
Hi Jon,

You might also want to investigate this technique:

http://www.metabuilders.com/Tools/OneClick.aspx

"Jon Booth" <jo*******@nusy stems.com.au> wrote in message
news:uJ******** ******@TK2MSFTN GP10.phx.gbl...
Hi All,
I'm trying to create a button that once clicked will disable itself (so as
not to be clicked twice)

I have the following in my cs
Button1.Attribu tes.Add("onClic k","return
document.Form1. Button1.disable d=true;");

It disables the button but does not perform the post back. What am I doing
wrong?

If I remove the line it posts back fine.

Thanks
Jon


Nov 18 '05 #4

Jon Booth wrote:
*Hi All,
I'm trying to create a button that once clicked will disable itsel
(so as
not to be clicked twice)

I have the following in my cs
Button1.Attribu tes.Add("onClic k","return
document.Form1. Button1.disable d=true;");

It disables the button but does not perform the post back. What am
doing
wrong?

If I remove the line it posts back fine.

Thanks
Jon *


you want the button to be used only once? (and your button i
performing some action which requires a postback, is it?)

then just put this portion of code at the end of the button clic
event.

me.enable = false

By the way, is it a HTML button or a ASP.NET button
-
weichun
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 18 '05 #5
Thanks for the advice.
I've extended your suggestion of using styles. I have a second html button
that is disabled and hidden. When the user clicks the asp button its hidden
and the html button is displayed.

Button1.Attribu tes.Add("onClic k","document.Fo rm1.Button1.sty le.display='non e
';document.Form 1.Button2.style .display='block ';");

I wanted to do it client side because I didn't want them to click it twice
by accident. rarely someon may want to submit twice in which case they can
go back to the page and do it.

Thanks for your help
Jon

"Jos" <jo************ ***@fastmail.fm > wrote in message
news:ui******** *****@TK2MSFTNG P12.phx.gbl...
Jon Booth wrote:
Hi All,
I'm trying to create a button that once clicked will disable itself
(so as not to be clicked twice)

I have the following in my cs
Button1.Attribu tes.Add("onClic k","return
document.Form1. Button1.disable d=true;");

It disables the button but does not perform the post back. What am I
doing wrong?

If I remove the line it posts back fine.


It disables the button before the actual postback, which is hence aborted.

I saw a similar post a few weeks ago, and I remember that
one of the solutions was to use visibility instead of disabled.
(document.Form1 .Button1.style. visibility='hid den';).

--

Jos

Nov 18 '05 #6

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

Similar topics

7
2594
by: Yaqian Fang | last post by:
Hi, could anyone please tell me how to make a button look like "being clicked"? A button picture always looks static, though a link is associated with it. Thank you.
8
1887
by: Galahad | last post by:
Here's the question: I have a form w/ TextBox controls and a Search Button control. Once the user clicks the Search Button, they get a Modal dialog w/ a datagrid that contains their search results. They select a row and click OK. The return value of the Module triggers an method that populates the TextBoxes w/ values and disables them. After the TextBoxes are disabled, I change the text of the buton to "Search Again" since I have to...
6
2839
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new data from the button is not available at this time as to allow the table to properly update. So basically, I need to call UpdateTable() twice, once from page load and once from button. This causes problems with my application, and I was trying...
8
5425
by: Lee | last post by:
Hi,I'm trying to have a button that fires a click event only once. What is the best way to do so that after the first button click, any the following clicks will be ignored.
3
8787
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called twice, once with postback true, and second time without postback. This only happens for this button. How can I sort out this issue, any clues what to look for to get this sorted please. <p>Search Bookmarks: <asp:TextBox ID="txtSearch"...
16
3435
by: Barry Gilmore | last post by:
Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!
1
1670
by: regelcom | last post by:
My son is trying to create an about form button for a form he has already created. Any help would be great. Thanks
9
4732
by: mosscliffe | last post by:
I am sorry but I am all very new and slow at understanding all this ASP.NET2. I found some code which showed how to page with a repeater. All very excited as I had been looking for this all day. It worked wonderfully, but it was in C# So I converted it to VB with http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx It got upset about private and so I changed those to protected
5
3956
by: visu | last post by:
Hi this is a question asked in this group two years back.. No answer for this question till date. now i am in the same situation of the questioner.. to find a solution for this problem. Can any one help me in this regard.? The question is: ---------------------------------------------------------------------------------------------------- Wondering if anyone can tell me if it's possible to have Javascript
5
5879
by: Tony | last post by:
I am continuing to develop an Access 2007 application which was originally converted from Access 2003. In Access 2003 I was able to disable the Access Close button in the top righthand corner of the screen. I have been unable to find any way to disable this button in Access 2007 and subsequently I have been forced to find ways to detect and handle the situations after the Access Close button has been clicked. I have been largely...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.