Hi guys,
I'm creating a shopping cart application and I'm having some issues with implementing a session state for my arraylist.
in my page load i declared
if (Session["Cart"] == null)
{
Session["Cart"] = new ArrayList();
}
else
{
ArrayList cart = (ArrayList)Session["Cart"];
}
to create the session if it doesn't exist yet. then i have an event handler for a button to add items to the arraylist
protected void onClick_AddBooking(object sender, EventArgs e)
{
int ClassID = Convert.ToInt32(Request.QueryString.Get("Class_Id"));
ArrayList cart1 = new ArrayList();
cart1 = Session["Cart"];
cart1.Add(ClassID);
i'm guessing i just don't know how to handle session states yet, thus the confusion. I'm essentially storing the class_ID then when the student confirms i'll store that to the DB and associate that ID with the Class Details.
Thanks in advance guys!