protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[3].Text = "Total: " + CarroDeCompras.CapturarProducto().SubTotal().ToString("C"); } }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Eliminar") { int productId = Convert.ToInt32(e.CommandArgument); CarroDeCompras.CapturarProducto().EliminarProductos(productId); } BindData(); }
public static CarroDeCompras CapturarProducto() { CarroDeCompras _carrito = (CarroDeCompras)HttpContext.Current.Session["ASPCarroDeCompras"]; if (_carrito == null) { HttpContext.Current.Session["ASPCarroDeCompras"] = _carrito = new CarroDeCompras(); } return(_carrito); }
protected void btnAgregar_Click(object sender, EventArgs e) { CarroDeCompras carrito = CarroDeCompras.CapturarProducto(); Button Button2 = (Button)sender; int ID = int.Parse(Button2.CommandArgument); carrito.Agregar(ID); Response.Redirect("VerCarrito.aspx"); }
protected void BindData() { GridView2.DataSource = CarroDeCompras.CapturarProducto().ListaProductos; GridView2.DataBind(); }