<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e) {
int counter = 0;
if(Application["ButtonClickCounter"] !=null)
{
counter = (int)Application["ButtonClickCounter"];
}
counter++;
Application["ButtonClickCounter"] = counter;
Label1.Text = "Button Clicked: " + counter.ToString() + " times";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>asp.net application state example: how to use application state in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Teal">asp.net application state example</h2>
<asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="Crimson">
</asp:Label>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
Text="Show Button Click Status"
OnClick="Button1_Click"
Font-Bold="true"
ForeColor="SeaGreen"
/>
</div>
</form>
</body>
</html>
Wednesday, 28 September 2011
asp.net application state example: how to use application state in asp.net
Subscribe to:
Post Comments (Atom)



No comments:
Post a Comment