"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Monday, May 17, 2010

Pls wait... on submit button click in asp.net C#

Hi everybody,
One of the social website giving this feature i notice this stuff from their i feel pretty nice i done only on page load just like gmail.I done this by calling a javascript on server side on page load event i'm giving event name, no of second,button name, Display message  :)

Important 

"Match Every event with color"

lets move to coding
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(3000); but_sve.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(but_sve, "") + ";this.value='Please wait...';this.disabled = true;");
    }
    protected void but_sve_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(5000); ClientScript.RegisterClientScriptBlock(this.GetType(), "reset", "document.getElementById('" + but_sve.ClientID + "').disabled=false;", true);
        lbl.ForeColor = System.Drawing.Color.Green;
        //lbl.Text = "Data Have Saved";
        Response.Redirect("http://www.google.com");//  from here ur coding can start
    }



U can download a demo from Here
Have a nice day... 'N happy Coding :)

SQL For DummiesSQL All-in-One Desk Reference For DummiesMicrosoft SQL Server 2008 For Dummies (For Dummies (Computer/Tech)) 

No comments: