Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

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

0.00/5 (No votes)
25 Apr 2011 1  
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
C#
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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here