protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { Repeater rpt = (Repeater)source; HiddenField IDControl = (HiddenField)rpt.FindControl("ItemID"); HiddenField NameControl = (HiddenField)rpt.FindControl("Item"); int MenuItemID = Convert.ToInt32(IDControl.Value); string ItemName = NameControl.Value; string ItemSize = e.CommandName.ToString(); decimal Price = Convert.ToDecimal(e.CommandArgument); StoredCart.InsertItem(MenuItemID, ItemName, ItemSize, 1, Price); Label1.Text = string.Format("{0} ({1}) added to the shopping cart", ItemName, ItemSize); }
protected void Repeater1_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { Repeater rpt = (Repeater)source; HiddenField IDControl = (HiddenField)rpt.FindControl("ItemID"); HiddenField NameControl = (HiddenField)rpt.FindControl("ItemName"); int GameID = Convert.ToInt32(IDControl.Value); string Title = NameControl.Value; string Console = e.CommandName.ToString(); decimal Price = Convert.ToDecimal(e.CommandArgument); //uncomment the next line once the Cart Classes have been added StoredCart.InsertItem(GameID, Title, Console, 1, Price); Label5.Text = string.Format("{0} ({1}) added to the shopping cart", Title, Console); }