另类办法,实现点击按钮后禁用,直到操作完成后恢复,防止重复操作,实用
2016-12-29 00:00
417 查看
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisableButton.aspx.cs" Inherits="DisableButton" %> <!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 runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="btn1" runat="server" Text="提交数据" onclick="btn1_Click" /> </div> </form> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class DisableButton : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { btn1.Attributes["onclick"] = this.GetPostBackEventReference(this.btn1) + ";this.value='处理中...';this.disabled=true;"; } protected void btn1_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); //三秒后恢复按钮 btn1.Style.Remove("disabled"); } }
相关文章推荐
- 另类办法,实现点击按钮后禁用,直到操作完成后恢复,防止重复操作,实用
- 另类办法,实现点击按钮后禁用,直到操作完成后恢复,防止重复操作,实用
- 另类办法,实现点击按钮后禁用,直到操作完成后恢复,防止重复操作,实用
- 在按钮点击后禁用它直到操作完成(利用线程休息)
- button按钮防重复提交(点击提交之后提交按钮变灰,操作执行完之后恢复)
- Jquery 实现表单提交按钮变灰,防止多次点击提交重复数据
- Swift防止按钮重复点击实现+Swift如何运用Runtime
- Android 快速实现防止网络重复请求&按钮重复点击的方法
- 防止按钮重复点击的js实现
- 防止快速连续点击按钮重复提交数据之一(自定义方法实现)
- 防止快速连续点击按钮重复提交数据之二(定时器实现)
- 几个常用的Swift Extension:防止按钮重复点击、增加友盟页面统计、Dispatch_once Swift实现
- jQuery遮盖蒙板(防止重复点击按钮误操作)
- asp.net禁用按钮以防止重复提交
- 注册或者点击按钮时,防止用户重复提交数据
- 完成用户数据的导出,生成文本文件Users.txt,实现点击按钮自动下载
- 防止在服务器处理完成之前用户多次点击提交按钮处理代码
- 防止按钮重复点击
- 操作TreeView:,选中左边树的节点,点击>>按钮 将选择的节点展现到右边的树中,同时将选择的节点从左边的树中移除。。点击<<实现同样的功能。。。。
- asp.net禁用按钮以防止重复提交