Disable LinkButton on click
Category: DotNet
Often we want to make sure a user does not click more than once on a particular function. Usually with things that write to the database or activate payment, we want to control this. You can use the following with a LinkButton or a standart asp.net Button.
protected void Page_Load(object sender, EventArgs e)
{
LinkButtonSave.Attributes.Add("OnClick", "this.disabled=true; this.onclick=function() { return false;}");
}
Note that this needs to be called from the codebehind, usually page_load works