// remove a product from the cart protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Index of the row being deleted int rowIndex = e.RowIndex; // The ID of the product being deleted string productId = grid.DataKeys[rowIndex].Value.ToString(); // Remove the product from the shopping cart bool success = ShoppingCartAccess.RemoveItem(productId); // Display status statusLabel.Text = success ? "<br />Product successfully removed!<br />" : "<br />There was an error removing the product!<br />"; // Repopulate the control PopulateControls(); }
// remove a product from the cart protected void grid_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Index of the row being deleted int rowIndex = e.RowIndex; // The ID of the product being deleted string productId = grid.DataKeys[rowIndex].Value.ToString(); // Remove the product from the shopping cart bool success = ShoppingCartAccess.RemoveItem(productId); // Display status statusLabel.Text = success ? "Продуктът премахнат успешно!" : "Имаше проблем при премахването на продукта! "; // Repopulate the control PopulateControls(); }