加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

ASP.NET 验证控件与防止按钮连按两次送出

发布时间:2020-12-16 09:27:52 所属栏目:asp.Net 来源:网络整理
导读:ASP.NET 验证控件与防止按钮连按两次送出 前阵子在网络上看到一篇不错的文章... 介绍ASP.NET使用验证控件时与防止按钮连按两次送出的问题 在此分享此篇文章给大家呀.... 数据来源:http://www.ithome.com.tw/plog/index.php?op=ViewArticlearticleId=11012bl

ASP.NET 验证控件与防止按钮连按两次送出


前阵子在网络上看到一篇不错的文章...

介绍ASP.NET使用验证控件时与防止按钮连按两次送出的问题

在此分享此篇文章给大家呀....

数据来源:http://www.ithome.com.tw/plog/index.php?op=ViewArticle&articleId=11012&blogId=418


小弟也做了一个实例测试一下...如下:

c#范例

.aspx

01 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="doubleClick.aspx.cs" Inherits="doubleClick" %>
02
03
04
05
06???? 未命名页面
07
08
09????

10????????

11???????????? 12???????????????? runat="server" ControlToValidate="TextBox1" ErrorMessage="不可为空白">

13????????????


14????

15
16
17
18
32
33


.cs

01 using ...System;
02 using System.Data;
03 using System.Configuration;
04 using System.Collections;
05 using System.Web;
06 using System.Web.Security;
07 using System.Web.UI;
08 using System.Web.UI.WebControls;
09 using System.Web.UI.WebControls.WebParts;
10 using System.Web.UI.HtmlControls;
11
12 public partial class doubleClick : System.Web.UI.Page
13 ...{
14 ????protected void Page_Load(object sender,EventArgs e)
15 ????...{
16 ????????this.Button1.Attributes.Add("onclick","check(this);");
17 ????}
18 ????protected void Button1_Click(object sender,EventArgs e)
19 ????...{
20 ????????//模拟数据库保存,处理时间5秒
21 ????????System.Threading.Thread.Sleep(5000);
22 ????????Response.Write(this.TextBox1.Text);
23 ????}
24 }

原文:大专栏 ?ASP.NET 验证控件与防止按钮连按两次送出

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读