Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Enable and disable button
Message
 
 
À
30/10/2013 15:15:38
Information générale
Forum:
Javascript
Catégorie:
JQuery
Divers
Thread ID:
01586844
Message ID:
01586887
Vues:
27
>>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?
>
>I've noticed that UT sometimes won't show stuff in pre tags when you use 'Preview' but will render correctly if you go ahead and post it. Can you try again to include the javascript ? Can you also post the HTML code for the buttons as they appear in the browser....

Actually I was not previewing my message (I almost never do) but tried to post it. UT didn't like my jQuery code.

But I found solution to my problem (from a message on Stackoverflow). What I needed to do is following: Enable all button at design time. Then disable those that need to be disabled in jQuery (in script). This way the post back (or no post back) that I set up at design time work.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform