protected void GridViewAlimentos_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName) { case "Agregar": int index = Convert.ToInt32(e.CommandArgument); int idAlimento = Convert.ToInt32(((Label)((GridView)sender).Rows[index].FindControl("lblCodigo")).Text); Alimento obj = aDAL.Find(idAlimento); carrito.AddAlimento(obj); CargarGridCarrito(); CargarTotales(); break; case "Default": break; } } catch (Exception ex) { UserMessage(ex.Message, "danger"); } }
protected void ListViewProduct_ItemCommand(object sender, ListViewCommandEventArgs e) { try { Label lblCodigo = e.Item.FindControl("lblCodigoProduct") as Label; int idProducto = Convert.ToInt32(lblCodigo.Text); Alimento al = aDAL.Find(idProducto); carrito.AddAlimento(al); //ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", "alert('Hola mundo.')", true); ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", "$.CrystalNotification({position: 1,title: \"'" + al.Nombre + "' agregado al carrito.\"});", true); } catch (Exception ex) { UserMessage(ex.Message, "danger"); } }