ASP.Net Maintain a list of objects for a button click event
<p>I am creating an asp.net page which loads data from a (SQL) visual studio database file (.mdf). </p>

<p>The data is loaded into a list of User objects (List) which contain the user data obtained from the database. This data is then displayed in a ASP.net table with a check box in column one. This allows the person viewing the webpage to in theory select users via the check boxes. </p>

<p>I have an ASP.net button also on the same page which when clicked will cause a post-back and go through the table row's and correctly identify which rows have and have not been checked. I am able to get the user data at this point as the Page_Load event is fired and the database contents are re-loaded for the second time.</p>

<p>Obviously this could become quite expensive obtaining the full list of users on each Page_Load so I have started investigating using the IsPostBack variable which allows me to identify whether it is a button click or standard page load.</p>

<p>The problem I have when using IsPostBack is the database contents loaded into the List on the initial Page_Load event would now be equal to null as the call into the database would never occur. This is understandable expected behavior and my question is what would be the best way to preserve the contents of the list so the button click can access the data loaded from the database on the initial Page_Load, without having to do another database query?</p>

<p>Thanks.</p>
