protected void GridViewOfertas_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName) { case "Agregar": int index = Convert.ToInt32(e.CommandArgument); int idOferta = Convert.ToInt32(((Label)((GridView)sender).Rows[index].FindControl("lblCodigo")).Text); Oferta obj = oDAL.Find(idOferta); carrito.AddOferta(obj); CargarGridCarrito(); CargarTotales(); break; case "Default": break; } } catch (Exception ex) { UserMessage(ex.Message, "danger"); } }
protected void ListViewOferta_ItemCommand(object sender, ListViewCommandEventArgs e) { Label lblCodigo = e.Item.FindControl("lblCodigoOferta") as Label; int idProducto = Convert.ToInt32(lblCodigo.Text); switch (e.CommandName) { case "AddToCart": carrito.AddOferta(oDAL.Find(idProducto)); break; case "OfertDetails": Session["OfertId"] = idProducto; Response.Redirect("/ClientPages/OfertaDetails.aspx"); break; } }