This paper is concerned with solving the distributed resource allocation optimization problem by multi-agent systems over undirected graphs. The optimization objective function is a sum of local cost functions associated to individual agents, and the optimization variable satisfies a global network resource constraint. The local cost function and the network resource are the private data for each agent, which are not shared with others. A novel gradient-based continuous-time algorithm is proposed to solve the distributed optimization problem. We take an event-triggered communication strategy and an event-triggered gradient measurement strategy into account in the algorithm. With strongly convex cost functions and locally Lipschitz gradients, we show that the agents can find the optimal solution by the proposed algorithm with exponential convergence rate, based on the construction of a suitable Lyapunov function. Finally, a numerical example is provided to demonstrate the effectiveness of the proposed scheme.