I'm currently looking for a way to prevent multiple forms from appearing in ASP.NET (i.e. the user clicks the submitbutton button several times, also raises the OnClick-Event).
I am currently doing 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 does not allow the form to be submitted several times in one run β however this method does not work for AsyncPostbacks, i.e. with UpdatePanel, so now I'm looking for an idea to do this without having to disable each button via JS after the button is clicked.
Thanks,
Dennis
source share