Reputation:
How would I create a list then on click add data to the list which is then stored into a session variable, then on another page retrieve the variable and output them? Currently I have:
Page Load:
List
<myClass>
listName=new List<
myClass>
OnClick:
listName.add(3);
listName.add(4);
Session[“IDs”]=listName;
Second Page
????
I need to get the whole list and add output the list so I can output (hopefully) the ‘3’ and ‘4’.
Upvotes: 0
Views: 240
Reputation: 74146
List<myClass> listNames = (List<myClass>)Session[“IDs”];
You can read about it on MSDN: ASP.NET Session State Overview
Upvotes: 2