Tuesday, November 5, 2013

Immediately Disable Button after On Click - ASP.net/Javascript

In one common scenario it will be helpful if you required to submit payment information online "click only once, or you may receive multiple charges. Or your specific requirement to click only once.

In C#

protected void Page_Load(object sender, EventArgs e)
{
                btnName.Attributes.Add("onclick", @"MovetoTop(); this.disabled = true; " +  this.Page.ClientScript.GetPostBackEventReference(btnName, null) + ";");
}

MovetoTop is the another function used to find the top of the webpage.

function MovetoTop() {      
        $("html, body").animate({ scrollTop: 0 }, "slow");
}

No comments:

Split the String values with a special character in MS Flow to convert this into Array

 Many times we have a requirement to prepare the Mailing address for some of the documents, suppose there are Address Line1, Address Line2, ...