Sys.WebForms.PageRequestManager.getInstance(); Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); |
<html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>Disable Button and Change Text of button</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="sc" runat="server" EnablePartialRendering="true"> </asp:ScriptManager> <script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); function BeginRequestHandler(sender, args) { document.getElementById('<%= lblMessage.ClientID %>').innerText = "Processing..."; document.getElementById('<%= btnSubmit.ClientID %>').innerText = "Processing"; args.get_postBackElement().disabled = true; } </script> <asp:UpdatePanel ID="updpnlSubmit" runat="server"> <ContentTemplate> <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" /> <asp:Label ID="lblMessage" runat="server"></asp:Label> </ContentTemplate> </asp:UpdatePanel> </form> </body> </html> |
In code behind button click write like this
protected void btnSubmit_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(2000); lblMessage.Text = "PostBack completed!!"; } |
Other related post
how to show progressbar during postback in asp.net
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
9 comments :
great tutorials for beginners. althought i know most of the techniques . i have still bookmarked ur site and added your rss feed on google reader for quick reference
try posting some advanced tuts bro
Thanks Zia sure i will learn and post advanced topics
Microsoft Jscript runtime error:
'sys' undefined
Much useful for the Freshers. Thanks a lot bro :)
not working properly. no effect on button..
only work in Internet Explorer !
not working in all browser ...