防止多次submit

原文链接:http://www.cnblogs.com/jacktang/articles/1687499.html

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);
    }

转载于:https://www.cnblogs.com/jacktang/articles/1687499.html

上一篇:对.net中的ViewState的理解


下一篇:16.2.1重学C++之【vertor基本概念、构造函数、赋值操作】