disabling a button when pressed

  • Thread starter Thread starter MattB
  • Start date Start date
M

MattB

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
 
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
 
Back
Top