473,326 Members | 2,126 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,326 software developers and data experts.

Button disable doesn´t work

Expand|Select|Wrap|Line Numbers
  1. protected void btnTest_Click(object sender, EventArgs e)
  2.     {
  3.         btnTest.Enabled = false;
  4.  
  5.          //here is some code - that code take 15seconds
  6.  
  7.          //and in the end i put the button n enabled
  8.          btnTest.Enabled = true;
  9.  
  10.     }
i don´t know why that happen...
when i click again the event accumulate!!!!
i don´t know...is there some property that need to be set?

thanks
Apr 14 '08 #1
9 1622
nateraaaa
663 Expert 512MB
Do you set the Enabled property in the Page Load event anywhere? The Page Load event will be hit before your button click event when the button is clicked.

Nathan
Apr 14 '08 #2
Plater
7,872 Expert 4TB
Is this a web or windows application?

You are remembering that you enabled the button at the end of your function right? So it's not going to stay disabled.
Apr 14 '08 #3
Frinavale
9,735 Expert Mod 8TB
The code that takes 15seconds to complete....is it run in a thread?
Apr 14 '08 #4
Do you set the Enabled property in the Page Load event anywhere? The Page Load event will be hit before your button click event when the button is clicked.

Nathan
No...i do not set the enabled property in the Page Load
Apr 15 '08 #5
The code that takes 15seconds to complete....is it run in a thread?
The code is a web service call...
Apr 15 '08 #6
Plater
7,872 Expert 4TB
Well, if this IS a web application, it will process that entire amount of code before returning back to the webpage.
So it will disable the button, run the code, then re-enable the button before it even gets back to the client browser.

If you want the button to be disabled while it's working, you're going to need to attach a javascript onclick (onclientclick in aspx code) to disable the button.
When the page reloads after processing from the regular onclick code, it will be enabled again.
Apr 15 '08 #7
Is this a web or windows application?

You are remembering that you enabled the button at the end of your function right? So it's not going to stay disabled.
Is a Web application.

The problem i think is that by default...the button properties start with enabled...and when i call a web service my settings go away...because the postback...and the page take the initial property
Apr 15 '08 #8
Well, if this IS a web application, it will process that entire amount of code before returning back to the webpage.
So it will disable the button, run the code, then re-enable the button before it even gets back to the client browser.

If you want the button to be disabled while it's working, you're going to need to attach a javascript onclick (onclientclick in aspx code) to disable the button.
When the page reloads after processing from the regular onclick code, it will be enabled again.
but the my button cannot be an asp button...correct?

i think you solve my problem!
Apr 15 '08 #9
Plater
7,872 Expert 4TB
Any button can work.
Apr 15 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

9
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...
3
by: Frances Del Rio | last post by:
the other day someone asked can u disable 'back' button w/JavaScript.. response was NO.. I asked really? because I've seen a lot of sites where 'back' button doesn't work and had always assumed...
5
by: Vern | last post by:
I would like to disable a button on the form if the user is not authorized to use it. I've created a custom button and would like for each button to know if it should be enabled or disabled...
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. ...
14
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by...
3
by: Jeff | last post by:
I have a payment form with a submit button. A large percentage of users double-click the submit button thus submitting their payment information twice. I would like to use javascript to disable...
2
by: James | last post by:
I have an ASP button on my form that will e-mail several people, and I'd like to disable it once the user clicks on it, so that they can only click on it once. I have a client side javascript...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
2
by: damonjulian | last post by:
hi ,i created 3 buttons such that if button1 is clicked it will disable button2 ,and clicking button3 will restore state of button2 to normal, to my dismay i find that button2 still responds to...
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...
1
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.