By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 1,795 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

disabling a button when pressed

P: n/a
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.enabled=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
Share this Question
Share on Google+
1 Reply


P: n/a
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.EventArgs 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********@yahoo.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.enabled=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 discussion thread is closed

Replies have been disabled for this discussion.