I'm currently searching for a way to prevent multiple form submits in ASP.NET (i.e. the user clicks on a submitbutton several times, causing the OnClick-Event to fire several times also).
Currently, I'm doing it like this:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Page.ClientScript.RegisterOnSubmitStatement(GetType(), "ServerForm",
"if (this.submitted) return false; this.submitted = true; return true;");
}
This works like a charm for synchronous postbacks - the 'submitted'-value will be reset after each postback and prevent the form from being submitted multiple times in the same run - however, this method does not work for AsyncPostbacks i.e. with an UpdatePanel, so now I'm searching for an idea to make this happen without having to dis- and enable each and every button via JS after clicking a button.
Thanks,
Dennis