Count the number of times a submit button has been clicked
Introduction
How i can find the user click on submit button in multipal time
GUI Html Code As Shown Below
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="counter.aspx.cs" Inherits="counter" %>
<!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="Button1" runat="server" onclick="Button1_Click"
Text="counter" />
Show Total Click of Particular User
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
From Image as shown below
count++;
int totalcount = count;
TextBox1.Text = totalcount.ToString();
}
Output as shown below
How i can find the user click on submit button in multipal time
GUI Html Code As Shown Below
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="counter.aspx.cs" Inherits="counter" %>
<!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="Button1" runat="server" onclick="Button1_Click"
Text="counter" />
Show Total Click of Particular User
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
From Image as shown below
On Button Click Couter Code Behind
static int count = 0;
protected void Button1_Click(object sender, EventArgs e)
{count++;
int totalcount = count;
TextBox1.Text = totalcount.ToString();
}
Output as shown below
Download sample code attached