
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PleaseWaitButton.aspx.cs" Inherits="PleaseWaitButton" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <div> <asp:Button ID="Button1" runat="server" Text="Button" /> </div> </div> </form> </body> </html> using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class PleaseWaitButton : System.Web.UI.Page { protected void Button1_Click(object sender, System.EventArgs e) { System.Threading.Thread.Sleep(5000); ClientScript.RegisterClientScriptBlock(this.GetType(), "reset", "document.getElementById('" + Button1.ClientID + "').disabled=false;", true); } protected void Page_Load(object sender, System.EventArgs e) { System.Threading.Thread.Sleep(5000); Button1.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(Button1, "") + "; this.value='Please wait...';this.disabled = true;"); } } |