Click here to Skip to main content
Click here to Skip to main content

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

By , 8 Feb 2012
 
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

License

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

About the Author

Sunasara Imdadhusen
Software Developer (Senior) Infostretch Ahmedabad-Gujarat
India India
Member
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen
+91 99095 44184
 
AWARDS:
  1. 1st Best Asp.Net article of SEP 2010
  2. 2nd Best Asp.Net article of MAY 2011
 
Read More Articles...

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralReason for my vote of 5 very usefulmemberCS14016 Feb '12 - 18:33 
Reason for my vote of 5
very useful

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 8 Feb 2012
Article Copyright 2011 by Sunasara Imdadhusen
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid