Keeping an object from being recreated and added to Session on page load/postback

  • Thread starter Thread starter Andy B
  • Start date Start date
A

Andy B

I have the following code inside a page_load event:

DataSet Store = new DataSet();
Session["Store"]=Store;

Every time the page loads, refreshes or the wizard flips from 1 wizardstep
to another, the dataSet is wiped out and reasigned to the Session making it
impossible to get anywhere. How do you stop stuff like this?
 
if ( Session["Store"] == null )
{
DataSet Store = new DataSet();
Session["Store"]=Store;
}
 
Back
Top