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)
8 Feb 2012 1  
Disable button after click and display text [Processing...]
Add the following lines on .aspx page:
XML
<asp:Button ID="btnProcess" runat="server" onclick="btnProcess_Click"
            Text="Process" />


Add the following line on .aspx.cs page (Page_Load).
C#
string strProcessScript = "this.value='Processing...';this.disabled=true;";
        btnProcess.Attributes.Add("onclick", strProcessScript + ClientScript.GetPostBackEventReference(btnProcess, "").ToString());


This will disable Button, and then change the text of the button "Processing...", and then continue on with the server side event btnProcess_OnClick event handler.

Thanks,
Imdadhusen

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