Consider, on the one part, a general nonlinear finite-dimensional optimal control problem and assume that it has a unique solution whose state is denoted by x*. On the other part, consider the sampled-data control version of it. Under appropriate assumptions, we prove that the optimal state of the sampled-data problem converges uniformly to x* as the norm of the corresponding partition tends to zero. Moreover, applying the Pontryagin maximum principle to both problems, we prove that, if x* has a unique weak extremal lift with a costate p that is normal, then the costate of the sampled-data problem converges uniformly to p. In other words, under a nondegeneracy assumption, control sampling commutes, at the limit of small partitions, with the application of the Pontryagin maximum principle.