Hi,
I created an asp.net Application using MS Visual 2010:
1. File -> New -> Project -> ASP.Net Empty Web Application (named as demo)
2. And I added a webform which contains Button and Label
3. In demo.cs file contains the below code,
public partial class _Default : System.Web.UI.Page
{
static int count;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
count = 5;
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = count.ToString();
}
}
4. If I click the button, the Label value shows as 0 not the
actual static value 5
5. The above same application works fine when I created as a File -> New -> Web Site -> ASP.Net Empty Web Site(named as demo)
Why the static value is not maintained in ASP.Net Project?
Thanks in Advance
...
Go to the complete details ...