Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to incorporate client side script
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01408438
Message ID:
01408473
Vues:
32
I stand corrected... further testing reveals what I had thought would happen. Not disabling the button still allows for it to be clicked again and posts the record multiple times. This is a catch-22 situation.


>Naomi,
>
>This does work. Taking out the disabled setting allows the server side OnClick method to fire. I originally thought, however, that not disabling the button would still enable the button to be pressed again and cause the same situation of having duplicates added, but it doesn't. I am guessing that the form.submit that immediately follows in the client side code takes care of this. Here is the final code for the button:
>
>
><mm:mmButton ID="btnSubmit" runat="server" Text="Save" OnClientClick="this.value = 'Submitting...';
>             ;this.form.submit(); "
>              OnClick="btnSubmit_Click" Width="100px" /></td>
>
>
>Thanks again for your help.
>
>Bob
>
>>Just curious, if you remove this.disabled=true and only leave this.value = 'Submitting';return true;
>>
>>would the code in OnClick event work?
>>
>>>This did not work as the OnClick event still does not fire.
>>>
>>>I will need to do more research on this. Thanks for your help.
>>>
>>>Bob
>>>
>>>>
>>>>OnClientClick must return true in order for OnClick to fire server code.
>>>>
>>>>Try
>>>>
>>>>OnClientClick="this.disabled=true;this.value='Submitting...';return true;" 
>>>>
>>>>
>>>>If this would not work for some reason, we may need to put this code into separate JavaScript function.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform