Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Jun 22, 2012 01:23 PM|LINK
On your description page you are creating a brand new array so you don't have anything but the last value as there is only one value that will be in your session.
try the following:
ArrayList idList = null;
if(Session["InstallationId"] != null)
idList = (ArrayList)Session["InstallationId"];
idList = new ArrayList();
This code checks to see if you already have an existing array in the session first, else it creates a new one.
You may want to try a different structure though for storing your data. A simpler one if you are doing product id, and product quantity is a NameValueCollection. It creates a name-value pair which would be useful here. That would avoid trying to figure out
which is the product id and which is the quantity. In this case, the Product Id would be a key that you can get values for, and the quantity would be the value.
NameValueCollection idList = null;
if(Session["idList"] != null)
idList = (NameValueCollection)idList;
idList = new NameValueCollection();
// add items to the collection like so:
To list all the items and values you can loop through the object to get both the key and the value
// example of a simple loop that lets you get a key, or a value based on an ordinal
for(int i = 0; i < idList.Count; i++)
// get a key value
// get a value