So i'm currently trying to get a simply cart working in a website. Basically, as the items are displayed from your cart on the cart page, a panel is populated with images, labels and buttons relating to each one.
What I want to do is assign a click event to every button created that calls a generic method to remove that item from the list. Here's the code for removing the item from the arraylist of items:
public void Remove(CartItem item)
{
ArrayList remove = (ArrayList)Session["ShoppingBasket"];
remove.Remove(item);
}
This is the event handler I'm trying to code for every button that's generated:
btnRemove.Click += new EventHandler(Remove(item));
For some reason, an error message is coming up saying that a method name is expected in the above line of code and I can't see where I'm going wrong. I'm not too familiar with using the EventHandler object so any guidance there would be greatly appreciated.