SIGN UP MEMBER LOGIN:    
ARTICLE

Disable a submit button during Post Backs

Posted by Suthish Nair Articles | C# Language August 23, 2010
This blog will help you with a small sample. You can restrict multiple button submission by using method ClientScript.GetPostBackEventReference.
Reader Level:
Download Files:
 

This blog is about, how to restrict multiple button submission or clicks?

Most of the developers facing the issue of how to handle multiple button clicks or submission by user at the same time. 

This can be achieved  by using method ClientScript.GetPostBackEventReference (for more information, refer msdn article).

"Returns a string that can be used in a client event to cause post back to the server. The reference string is defined by 

the specified control that handles the post back and a string argument of additional event information."


Lets start with an sample. Drag n drop three Button control to form. One inside UpdatePanel and the other outside of the UpdatePanel.


#.aspx source

111.jpg


Now the code behind part. We will bind this method on Page Load.

Also, am using Thread.Sleep for 5 sec delay.

22.jpg


Note: The second button will do a full post back. The third button, we can even attach JavaScript validation check before calling get post back event handler.

Button1:

Button1.gif

Button2: above same button effect, but a full post back will happen.

Button3: first it will show the alert followed by above same button effect.

Button3.gif

Hope this blog helped you. Please post your comments. Sample codes attached for download.
 

Login to add your contents and source code to this article
share this article :
post comment
 

that was good Article

Posted by Naresh Babu Gopavaram Jun 02, 2011

Very Nice Article....

Posted by Manish Tewatia Mar 02, 2011

welcome man.. enjoy coding..

Posted by Suthish Nair Aug 26, 2010

Hey mate, your solution is very useful, thanks very much.

Posted by YORK HE Aug 23, 2010
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor