Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Please wait on button click

Posted by Viral Sarvaiya on December 29, 2009

C#:::

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) {
Button1.Attributes.Add(“onclick”, (ClientScript.GetPostBackEventReference(Button1, “”) + “;this.value=\’Please wait…\’;this.disabled = true;”));

vb.net:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

System.Threading.Thread.Sleep(5000)

ClientScript.RegisterClientScriptBlock(Me.GetType, _ “reset”, “document.getElementById(’” & Button1.ClientID & “‘).disabled=false;”, True)

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Button1.Attributes.Add(“onclick”, ClientScript.GetPostBackEventReference(Button1, “”) _ & “;this.value=’Please wait…’;this.disabled = true;”)

End Sub
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: