You need an item named link cable where you can find it to secret places which are unlocked with a key (you can buy one in the kecleon shop for $8000). After you find a link cable go to the luminous spring and click that you want to evolve Haunter,Machoke,etc. It will ask you if you need an item. Click yes and give the link cable. The link cable is needed for all pokemon which evolve via trade to Diamond & Pearl.
Source-Gamebeater gave this answer