protected void RemoveItem_OnClick(object sender, EventArgs e) { Button btn = sender as Button; GridViewRow row = btn.NamingContainer as GridViewRow; string ISBN = CartGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString(); BookItem myitem = new BookItem { ISBN = ISBN, quantity = -1 }; ServicesShoppingCart.AddItem(myitem); RenderGrid(); }
protected void AddItemtoCar_OnClick(object sender, EventArgs e) { Button btn = sender as Button; GridViewRow row = btn.NamingContainer as GridViewRow; string ISBN = WishGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString(); ServicesShoppingCart.AddItem(new BookItem { ISBN = ISBN, quantity = 1 }); ServicesShoppingCart.RemoveWishItem(ISBN); RenderGrid(); }
protected void AddButton_OnClick(object sender, EventArgs e) { Button btn = sender as Button; GridViewRow row = btn.NamingContainer as GridViewRow; string ISBN = BookDetailsGridView.DataKeys[row.RowIndex].Values["ISBN"].ToString(); string title = BookDetailsGridView.DataKeys[row.RowIndex].Values["title"].ToString(); double price = double.Parse(BookDetailsGridView.DataKeys[row.RowIndex].Values["price"].ToString()); BookItem myitem = new BookItem { ISBN = ISBN, quantity = 1, title = title, price = price }; ServicesShoppingCart.AddItem(myitem); Response.Redirect("Shopping_Cart.aspx"); }