In ASP.Net, every instance of your Code Behind class is created when the page loads, so your class level variables are reset.
Your best option is probably to save the list that you want to keep in the session. If this makes things easier, you can create a getter for a list that reads data from a session variable. In C #, it will look like this:
private List MyList
{
get { return Session["ListKey"] as List; }
set { Session["ListKey"] = value; }
}
source
share