Variable Persistence in ASP.NET - or lack thereof.
Inside the class of my webform, I define a new variable, an integer, like this:
Code:
Public Class WebForm1
Inherits System.Web.UI.Page
Protected test As integer
Then I have a button that just assigns a value to Test.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
test = 5
End Sub
However, when the users clicks a submit button (an empty one) and the page refreshes, test returns to 0. Why? Is there any way I can have this variable persist!?