国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

ASP.NET 多次提交的解決辦法2

來源:懂視網 責編:小采 時間:2020-11-27 22:44:42
文檔

ASP.NET 多次提交的解決辦法2

ASP.NET 多次提交的解決辦法2:例如: protected void Page_Load(object sender, EventArgs e) { //.net1.1 Button1.Attributes.Add(onclick, this.disabled=true; + this.GetPostBackEventReference(this.Button1)); //.n
推薦度:
導讀ASP.NET 多次提交的解決辦法2:例如: protected void Page_Load(object sender, EventArgs e) { //.net1.1 Button1.Attributes.Add(onclick, this.disabled=true; + this.GetPostBackEventReference(this.Button1)); //.n

例如:
protected void Page_Load(object sender, EventArgs e)
{
//.net1.1
Button1.Attributes.Add("onclick", "this.disabled=true;" + this.GetPostBackEventReference(this.Button1));
//.net 2.0以上
Button1.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(Button1, ""));
}
為了測試,我們可以建立一個頁面,加入一個btnAdd按鈕
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddAndEditUser.aspx.cs" Inherits="AddUser" %><html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>添加和編輯頁面示例</title>
</head>
<body>
<form id="frmMain" runat="server">
<asp:Button ID="btnAdd" runat="server" CssClass="INPUT-BUTTON-Save" OnClick="btnAdd_Click">
</asp:Button>
</form>
</body>
</html>
/*----------------------------------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class AddUser : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
btnAdd.Attributes.Add("onclick", "this.disabled=true;" + this.ClientScript.GetPostBackEventReference(btnAdd, ""));
}
protected void btnAdd_Click(object sender, EventArgs e)
{
//模擬網絡擁塞5秒鐘
System.Threading.Thread.Sleep(5000);
}
}
可見當點擊了按鈕,需要等5秒鐘按鈕才能點擊。即頁面回發一后按鈕才能用。這樣可以有效的防止用戶多次點擊按鈕,造成多次提交!

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

ASP.NET 多次提交的解決辦法2

ASP.NET 多次提交的解決辦法2:例如: protected void Page_Load(object sender, EventArgs e) { //.net1.1 Button1.Attributes.Add(onclick, this.disabled=true; + this.GetPostBackEventReference(this.Button1)); //.n
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 国产一区二区三区在线 | 国产精品福利久久久久久小说 | 久久一区二区三区免费 | 国产精品一区二区三 | 日本欧美韩国专区 | 国产免费高清视频在线观看不卡 | www久久com| 成人一级免费视频 | 香蕉成人啪国产精品视频综合网 | 中文字幕一区二区三区在线观看 | 91麻豆精品国产91久久久久久 | 久久免费精品国产72精品剧情 | 超级毛片| 免费国产视频 | 99久久免费精品国产免费高清 | 日韩在线视频网 | 国产精品久久久久999 | 国产三级在线免费 | 一级成人毛片 | 国产成人一区二区三区 | 欧美孕妇乱大交xxxxx | 国产精品一页 | 亚洲综合欧美日本另类激情 | 亚洲欧美日韩精品永久在线 | 久久久久国产精品美女毛片 | 久久综合爱 | 亚洲图片国产日韩欧美 | 亚洲日韩图片专区第1页 | 亚洲国产精品综合久久网络 | 免费精品在线观看 | 特级全黄一级毛片视频 | 国产免费一区二区三区 | 激情一区二区三区成人 | 亚洲欧美另类专区 | 国产精品美女久久久久网站 | 免费一区二区视频 | 欧美激情影院 | 午夜香蕉视频 | 欧美一级xxx| 亚洲欧美在线一区 | 国产高清在线看 |