473,788 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

disabling a button when pressed

I want to have a "finalize sale" button that disables it's self
immediately when pressed (so they can't hit it twice). I thought putting
mybutton.enable d=false in the click event would do it, but I guess that
requires a postback. Any suggestions (or even better and example) on doing
it on the client end so it's immediate and doesn't need a postback? Thanks!

Matt
Nov 18 '05 #1
1 1131
Matt,
The following works for me:

- drop a button on your form in the visual studio asp.net designer.
- double click on the button to generate an event handler for it.
- add some code something like below

private void Button1_Click (objecxt sneder, System.EventArg s e)
{
Button btn = (Button)sender;
btn.Enabled = false;
}

this code worked fine for me.
Just so it's clear, this is in 'code behind' - the .cs file and not the aspx
page.
If you your event code setting in there, this might have something to do
with it.

hope that helps,
sincerely,
J
"MattB" <so********@yah oo.com> wrote in message
news:c7******** ****@ID-86156.news.uni-berlin.de...
I want to have a "finalize sale" button that disables it's self
immediately when pressed (so they can't hit it twice). I thought putting
mybutton.enable d=false in the click event would do it, but I guess that
requires a postback. Any suggestions (or even better and example) on doing
it on the client end so it's immediate and doesn't need a postback? Thanks!
Matt

Nov 18 '05 #2

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

Similar topics

1
2837
by: robert | last post by:
hi! I want to have a custom button change appearance when pressed and then call a function and change back to its original appearance when released. here's what i have now, which works mostly. "drop" is my handler for the button, its argument tells me which button was pressed. i have a number of these buttons and they are organized in a table. there is a fair amount of superstition here, the result of many tiny
3
1976
by: James McGivney | last post by:
I have a project in VS.NET using C# I have a series of buttons on an aspx page. When one of the buttons is pressed, a panel becomes visible and allows the user to enter and edit data. I want to use this data to modify the text of the button I am thinking of storing a unique identifier in View State when the button is pressed. After the user enters or edits the data, I plan use a Switch structure indexed from the number stored in View State...
9
3635
by: jcnews | last post by:
When designing a webpage, is there a way to disable the back button? It must be possible. I am asking because there are certain web applications that I have used that require the user to never press the back button from certain screens. If the back button is pressed, it will bill for charges, even if the user is pressing the back button as a way of canceling. Another example would be Mambo CMS -- if you click the back button on...
18
3070
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to button style, I must use a System.Windows.Forms.Button. I can not find a way to tell when it is momentaraly pressed. I tried calling the API SendMessage with the button handle and BM_GETSTATE to get the state of the button. This will only return...
1
1429
by: David Hearn | last post by:
I have a javascript function that is fired on the KeyDown event of a textbox. I am adding the attribute to the textbox at page load to run this javascript function. The javascript runs as expected and the text box that is specified in the javascript gets the focus set to it, but my problem is that the default button on the form is being pressed also so once the textbox gets the focus, you barely see it before the page redirects. I want...
3
1756
by: noddy | last post by:
I have a button <input type="button" value="Get data"> When it is clicked a database is accessed and the data is eventually displayed on the screen. While the data is being retrieved the button is displayed in its "pressed in" state. When the data arrives and is displayed the button pops out to its normal "unpressed" state.
1
2250
by: arggg | last post by:
I created a submit form that calls a javascript:AjAX Command that will call the data and submit it without have the page refresh. This works perfect in Firefox however in IE and Opera when the submit button is pressed it just disables the button and does not submit the data. Any idea? <script type="text/javascript" src="<?=$config->getKey('Site_URL')."js/AJAX.js"?>"></script> <form name="EditUser" method="post" accept="text/plain"...
3
2509
by: =?Utf-8?B?cHJhZGVlcF9UUA==?= | last post by:
Hi All, Can anyone please explain me why I am not able to disable Browser caching in ASP.net by writing the following code Response.Buffer = true; Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0)); Response.Expires = 0; Response.CacheControl = "no-cache";
20
1271
by: Geoff Cox | last post by:
Hello, I am not at clear how to tackle this one. Say the note middle C is played, just once. Then when the user clicks on a play image a series of notes are played starting with middle C and the user the user has to say whether the last sound is the same as the first or different. There are 4 sets of this.
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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
10370
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
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
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...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5402
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...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3677
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.