This post describes how to prevent submitting an ASP.Net form twice.  I stumbled across a rather neat and handy way to achieve this by the following:

public void PreventMultipleClicks(Button button, Page page)
{
    button.Attributes.Add("onclick", "if(Page_ClientValidate()){this.disabled=true;this.value='Processing Request...';" + page.ClientScript.GetPostBackEventReference(button, String.Empty).ToString() + "}");
}

protected void Page_Load(object sender, EventArgs e)
{
    PreventMultipleClicks(submitRequest, this.Page);
}

I also re-label the button to say something meaningful (Such as ‘Processing Request…’ in this instance).  What this does is each time the page loads it binds the onclick event to my submit button (with an ID of ‘submitRequest’).  The onclick event disables and re-labels the submit button, and then posts the form.

 

 

Prevent Submitting an ASP.Net form Twice
Comments have now been disabled. If you have a question to ask about this post please ask the community!