一、测试代码:

1、aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head >
    <title>Untitled Page</title>

    <script type="text/javascript">//让控件隐藏
    function disableObject(obj)
    {
        obj.disabled = true;
    }
    </script>   
</head>
<body>
    <form >
    <div>
        <input type="button" />
        <br />
        <asp:Button ID="btn_standard" Text="btn_standard" runat="server" OnClientClick="disableObject(this);" OnClick="btn_standard_Click" />
    </div>
    </form>
</body>
</html>

2、cs: 

 protected void btn_html_serverclick(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(3000);
        Response.Write("actions of btn_html_serverclick");
    }

    protected void btn_standard_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(3000);
        Response.Write("actions of btn_standard");
    }

备注:以上代码中“System.Threading.Thread.Sleep(3000);”的用意是为了避免按钮事件的执行时间太短、页面刷新太快时用脚本修改的按钮状态无法体现。

相关文章:

  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
  • 2021-05-07
  • 2022-12-23
  • 2021-12-14
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案