Shopping Cart Control - Update Statement

Posted by Akiii under C# on 7/21/2012 | Points: 10 | Views : 1323 | Status : [Member] | Replies : 0
I have a control named as ShoppingCartControl. In it, there is an update button. The code behind that is :-

protected void ctrlShoppingCart_ItemUpdating(object sender, ItemEventArgs e)
{
ShoppingCartControl control = sender as ShoppingCartControl;
int qty=0;

foreach (var c in control.Items)
{
int recid = ((ShoppingCartControlItem)c).ShoppingCartRecId;
if (recid == e.ID && e.ID!=null)
{
qty = ((ShoppingCartControlItem)c).Quantity;
}

}
cart.SetItemQuantity(e.ID, qty);
Response.Redirect("shoppingcart.aspx");
}


Can anyone explain me this code step by step or what is meant by "sender as ShoppingCartControl".



Thanks and Regards
Akiii




Responses

(No response found.)

Login to post response