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






4.80/5 (18 votes)
Disable button after click and display text [Processing...]
Add the following lines on .aspx page:
<asp:Button ID="btnProcess" runat="server" onclick="btnProcess_Click"
Text="Process" />
Add the following line on .aspx.cs page (Page_Load
).
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