Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enable and disable button
Message
From
30/10/2013 16:13:13
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
 
General information
Forum:
Javascript
Category:
JQuery
Miscellaneous
Thread ID:
01586844
Message ID:
01586895
Views:
23
Glad you got it working.

>Thank you for the code. Please see the solution to the problem in my message to Viv.
>
>>Here is some quick and dirty code that might help. That way you don't have deal with the asp.net properties.
>>
>>UT doesn't like html code very well :(.
>>
>>
>>input type="button" id="button1" class="mybuttons" value="button1" 
>>input type="button" id="button2" class="mybuttons" value="button2"
>><script>
>>    $(document).on('click','.mybuttons',funciton(e){
>>       if (this.id == 'button1'){
>>           $("#button2").attr('disabled','disabled');
>>           // do stuff here
>>       } else {
>>           $("#button1").removeAttr('disabled');
>>           // do stuff here
>>       }
>>    });
>></script>
>>
>>>The first button is Start which (in jQuery) sets value for event.timeStamp to a variable. The second button gets new value of event.timeStamp and calculates the difference. Basically times how much time elapsed. When the first one is enabled the second should be disabled and the other way around. The calculations work but the post back messes things.
>>>
>>>>What are these buttons supposed to do?
>>>>
>>>>>I have been struggling with the following problem:
>>>>>
>>>>>Simplified:
>>>>>
>>>>>on ASP.NET page I have two buttons. One has property Enabled is 'true' another Enabled is "false". I don't want the page to post back to the server on either button clicks. So I have - for both buttons - property OnClientClick="return false;" On the click of the first (enabled button) in the jQuery I enable the second button using the following code:
>>>>>
>>>>>
>>>>>I tried to put jQuery code between the pre and pre but UT does not like it <argg>
>>>>>
>>>>>
>>>>>The button is enabled, so far all is well. But when I click on the second button (cmdSuspend) the page is posted back to the server. It appears that if initially the button is disabled (Enable='false') the OnClientClick='return false;" is ignored. I tried to do this OnClientClick in jQuery as following:
>>>>>
>>>>>
>>>>>I tried to put jQuery code between the pre and pre but UT does not like it <argg>
>>>>>
>>>>>
>>>>>but still click on this button post the page back to the server. If I initially make the button enabled, then last (in jQuery) enabling or disabling it does not affect post back.
>>>>>
>>>>>What can I do or what am I missing?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform