Click here to Skip to main content
11,487,721 members (74,207 online)
Click here to Skip to main content

Tagged as

Disable button after click and display text [Processing...]

, 25 Apr 2011 CPOL 3.9K 2
Rate this:
Please Sign up or sign in to vote.
Good, my solution is by using Client Javascript.aspx pagescript //by using jqueryfunction DocumentReady() { //Button disable...
Good, my solution is by using Client Javascript

.aspx page
<asp:Button ID="btnSave" runat="server" Text="Save" CssClass="btn DisableWhenClick"
                    CommandName="Save" OnClick="btnAction_Click" />

script //by using jquery
function DocumentReady() {
    //Button disable when Click
    $(".DisableWhenClick").click(function() {
        $(this).attr("disabled", true);
        $(this).val("Processing...");
    });

OK, then any button you need to disable when submit, you just need to add class "DisableWhenClick"

Enjoy!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

duluohua

China China
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 2 Disables other functionality; that i... Pin
SteveSM27-May-11 13:25
memberSteveSM27-May-11 13:25 
GeneralThis alternative seems to disable the OnClick event. Pin
SteveSM25-May-11 17:32
memberSteveSM25-May-11 17:32 
GeneralGood one! Pin
Sunasara Imdadhusen2-May-11 23:54
memberSunasara Imdadhusen2-May-11 23:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 25 Apr 2011
Article Copyright 2011 by duluohua
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid