防止多次submit

http://www.codeproject.com/KB/aspnet/DisableSubmitButton.aspx

Disable ASP Button on Submit and capture the PostBack OnClick Event
By Christopher G. Lasater

This article describes how to disable a ASP button on click to prevent multiple clicks and still fire the button event on the server.

override protected void OnInit(EventArgs e)
    {
        btnOpen.Attributes.Add("onclick", "javascript:" +
                  Button1.ClientID + ".disabled=true;" +
  this.ClientScript.GetPostBackEventReference(btnOpen, ""));
        base.OnInit(e);
    }

posted @ 2010-03-16 17:43  Jack Tang  阅读(173)  评论(0编辑  收藏  举报