protected void dgvProductos_RowCommand(object sender, GridViewCommandEventArgs e) { ListaProductos = negocio.listar2(); int index = Convert.ToInt32(e.CommandArgument); string IDSeleccionado = dgvProductos.Rows[index].Cells[0].Text; int idSeleccionado = Convert.ToInt32(IDSeleccionado); Productos aux = ListaProductos.Find(A => A.id == idSeleccionado); if (ListaProductos != null) { if (e.CommandName == "Select2") { Session.Add(Session.SessionID + "Producto", aux); Response.Redirect("ModificarProducto.aspx"); } if (e.CommandName == "Select") { negocio.eliminar(aux.id); Response.Redirect("ListaProducto.aspx"); } } }