For example:
protected void Page_Load(object sender, EventArgs e)
{
//.net1.1
("onclick", "=true;" + (this.Button1));
//.net 2.0 or above
("onclick", "=true;" + (Button1, ""));
}
For testing, we can create a page and add a btnAdd button
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="" Inherits="AddUser" %><html xmlns="http:///1999/xhtml">
<head runat="server">
<title>Add and edit page example</title>
</head>
<body>
<form runat="server">
<asp:Button ID="btnAdd" runat="server" CssClass="INPUT-BUTTON-Save" OnClick="btnAdd_Click">
</asp:Button>
</form>
</body>
</html>
/*----------------------------------------------------------------
using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
public partial class AddUser :
{
protected void Page_Load(object sender, EventArgs e)
{
("onclick", "=true;" + (btnAdd, ""));
}
protected void btnAdd_Click(object sender, EventArgs e)
{
//Simulate network congestion for 5 seconds
(5000);
}
}
It can be seen that when the button is clicked, it takes 5 seconds to click the button. That is, the button can only be used after the page is posted back. This can effectively prevent users from clicking the button multiple times, causing multiple submissions!
protected void Page_Load(object sender, EventArgs e)
{
//.net1.1
("onclick", "=true;" + (this.Button1));
//.net 2.0 or above
("onclick", "=true;" + (Button1, ""));
}
For testing, we can create a page and add a btnAdd button
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="" Inherits="AddUser" %><html xmlns="http:///1999/xhtml">
<head runat="server">
<title>Add and edit page example</title>
</head>
<body>
<form runat="server">
<asp:Button ID="btnAdd" runat="server" CssClass="INPUT-BUTTON-Save" OnClick="btnAdd_Click">
</asp:Button>
</form>
</body>
</html>
/*----------------------------------------------------------------
using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
public partial class AddUser :
{
protected void Page_Load(object sender, EventArgs e)
{
("onclick", "=true;" + (btnAdd, ""));
}
protected void btnAdd_Click(object sender, EventArgs e)
{
//Simulate network congestion for 5 seconds
(5000);
}
}
It can be seen that when the button is clicked, it takes 5 seconds to click the button. That is, the button can only be used after the page is posted back. This can effectively prevent users from clicking the button multiple times, causing multiple submissions!